1. Connect to SCCM PS
#Connect-CMSite -SiteServer 'servername' -SiteCode Axx
2. When Server names are different in AD and VMware
$List = "A01002E8" | Get-DevicesInCollection
$List += "Server1"
$List = $List | ? {$_ -ne "Server2"}
$List = $List | ? {$_ -ne "Server3"}
$List = $List | ? {$_ -ne "Server4"}
$List = $List | ? {$_ -ne "Server5"}
$List = $List | ? {$_ -ne "Server6"}
$List = $List | ? {$_ -ne "Server7"}
$List = $List | ? {$_ -ne "Server8"}
$List += "server9 (server9-2012)"
3. $testservers = Get-Content C:\temp\testvms.txt
4. Works remotly on multiple
Get-WmiObject win32_operatingsystem -ComputerName $testvmlist | select csname, @{LABEL='LastBootUpTime';EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}}
5. Check last 10 eventviewer setup logs
Get-WinEvent -LogName Setup -MaxEvents 10 -ComputerName Axyz01
6. Get-Collection IDs
Get-CMDeviceCollection | where {$_.Name -like "Windows Servers patching main *"} | Select Name, CollectionID
7. Get lastbootup time
$rebootcheck = Get-DevicesInCollection -CollectionsId A01002CB
Get-WmiObject win32_operatingsystem -ComputerName $rebootcheck | select csname, @{LABEL='LastBootUpTime';EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}}
8. Find Maintanance window on a device collection(Description)
Get-CMMaintenanceWindow -CollectionId A01002CB