This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
break #To prevent accidental execution of all commands | |
# WMI cmdlets: Work against anything, where DCOM RPC dynamic port range is available | |
# CIM cmdlets: Exist in PowerShell v3 and up, can use DCOM or WSMAN. Can have CimSessions. Microsoft going forward. | |
$Creds = Get-Credential | |
Get-WmiObject -Class win32_computersystem | |
Get-WmiObject -Class win32_computersystem -ComputerName server1 -Credential $Creds | |
Get-CimInstance -Class win32_computersystem -ComputerName server1 -Credential $Creds | |
$Session = New-CimSession -ComputerName server1 -Credential $Creds | |
Get-CimInstance -Class win32_computersystem -CimSession $Session | |
Get-CimSession |