My Blog List
Friday, May 24, 2024
Thursday, May 23, 2024
SCCM PS
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
Steps to extract ntfs share details from file server shares
As part of a file server consolidation effort, I was tasked to come up with a method to move multiple shares on multiple shares to a WSFC. I...
-
MgGraph - Retrieve Sign in activity on guest accounts Retrieve UserPrincipalName , SignInActivity & CreatedDateTime # Get all guest ...
-
$Reports = Get-GPO -All | Get-GPOReport -ReportType Xml $DriveMappings = @() ForEach ($Report In $Reports) { $GPO = ([xml]$Report).GPO ...
-
1. #Check installed windows updates: wmic qfe 2. PS H:\> Get-FileHash C:\Excel\NSClient.msi -Algorithm MD5 3. #get installe...