Reboot remote computer and wait
This script that will send a reboot command to a remote computer. It will then monitor for it to go offline and then come back online. Optionally, you can have it monitor for a service to return to running. # The remote computer to reboot $computer = 'YourComputer' # the name of a service to check for after reboot $Service...
View All Scheduled Tasks in a Single Pane
Get-ScheduledTask | Select-Object * | Out-Gridview Source: Guy Leech
List all Devices in Device Manager
Get-WmiObject Win32_PNPEntity | Sort-Object -Property PNPClass | Format-Table Name, PNPClass, DeviceID, Manufacturer, Status Source: Thorsten E.
Query Remote Registry for Key Value
# Open the specified Registry Hive on a remote machine specified. LocalMachine = HKLM / CurrentUser = HKCU $computer = 'localhost' $w32reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine',$computer) # Open the specific registry key (exclude hive from path) $keypath = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI' $SubKey = $w32reg.OpenSubKey($keypath) # Return data for a specific value $SubKey.GetValue('LastLoggedOnUser') # List all values $SubKey.GetValueNames() # Return data for all values to...
Determine if Hyper-Threading is enabled
Function Check-HyperThreading($ComputerName){ # Get the Processor information for the computer $Proc = Get-WMIObject Win32_Processor -ComputerName $ComputerName # Determine if hyper-threading is enabled $CPUCount = @($Proc).count $NumberOfLogicalProcessors = $($Proc | measure-object -Property NumberOfLogicalProcessors -sum).Sum $NumberOfCores = $($Proc | measure-object -Property NumberOfCores -sum).Sum # Output the results as a PS object [pscustomobject]@{ Computer = $ComputerName CPUCount = $CPUCount NumberOfLogicalProcessors = $NumberOfLogicalProcessors NumberOfCores...
Get Processor Utilization Percentage
Get-WmiObject win32_processor -ComputerName $computer | Measure-Object -property LoadPercentage -Average | Select @{Label = "Computer"; Expression = {$computer}},@{Label = "CpuUsage"; Expression = {$_.Average}}
Get Memory Utilization Percentage
Get-WmiObject Win32_OperatingSystem -ComputerName $computer | Select @{Label = "Computer"; Expression = {$computer}}, @{Label = "MemoryUsage"; Expression = {100 - [math]::Round(($_.FreePhysicalMemory/$_.TotalVisibleMemorySize)*100,0)}}
Check Remote Desktop Protocol Port
Test-NetConnection -Computer $Server -CommonTCPPort RDP
Check if Port is Open
$socket = new-object Net.Sockets.TcpClient $socket.Connect($IPAddress,$Port) $socket.Connected