This file contains hidden or 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
| Set-CMSoftwareUpdateGroup -Name 'SUM WRK 2017 11 November' -ClearExpiredSoftwareUpdate -ClearSupersededSoftwareUpdate |
This file contains hidden or 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
| Import-Module $env:SMS_ADMIN_UI_PATH.Replace("\bin\i386","\bin\configurationmanager.psd1") | |
| $CMSite = Get-PSProvider -PSProvider CMSITE | |
| Set-Location -Path "$($CMSite.Drives.Name):\" | |
| # 2017 Software Update Groups | |
| #Create new Software Update Group for 2017 Updates | |
| New-CMSoftwareUpdateGroup -Name 'SUM WRK 2017 Compliance' | |
| #Get 2017 Software Updates Groups | |
| $SWGroups = Get-CMSoftwareUpdateGroup -Name 'SUM WRK 2017*' -ForceWildcardHandling | |
This file contains hidden or 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
| $CollectionMembers = Get-CMCollectionMember -CollectionId PS10008E | |
| foreach($Member in $CollectionMembers){ | |
| $ResourceQuery = Get-CimInstance ` | |
| -Namespace 'Root\SMS\Site_PS1' ` | |
| -Query "Select * from SMS_R_System where ResourceID=$($Member.ResourceID)" | |
| $ResourceQuery.ResourceNames | |
| } |
This file contains hidden or 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
| Invoke-WsusServerCleanup ` | |
| -CleanupObsoleteComputers ` | |
| -CleanupObsoleteUpdates ` | |
| -CleanupUnneededContentFiles ` | |
| -CompressUpdates ` | |
| -DeclineExpiredUpdates ` | |
| -DeclineSupersededUpdates |
This file contains hidden or 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
| #How many devices in Active Directory | |
| Get-ADComputer -Filter * | Measure-Object |
This file contains hidden or 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
| #How many disabled devices in Active Directory | |
| Get-ADComputer -Filter {(Enabled -eq $False)} | Measure-Object |
This file contains hidden or 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
| #AD Computer account last logon date | |
| Get-ADComputer -Identity KLASSB315-2 -Properties LastLogonDate | |
| #AD Computer account last logon date in days | |
| $ADComputerInfo = Get-ADComputer -Identity PC1 -Properties LastLogonDate | |
| $TimeSpan = New-TimeSpan -Start $ADComputerInfo.LastLogonDate -End (Get-Date) | |
| $TimeSpan.Days |
This file contains hidden or 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
| #Check if device exists in Configuration Manager | |
| Import-Module $env:SMS_ADMIN_UI_PATH.Replace("\bin\i386","\bin\configurationmanager.psd1") | |
| $CMSite = Get-PSProvider -PSProvider CMSITE | |
| Set-Location -Path "$($CMSite.Drives.Name):\" | |
| #Query against Configuration Manager | |
| $ADComputerInfo = Get-ADComputer -Identity PC1 | |
| Get-CMDevice -Name $ADComputerInfo.Name |
This file contains hidden or 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
| Import-Module $env:SMS_ADMIN_UI_PATH.Replace("\bin\i386","\bin\configurationmanager.psd1") | |
| $CMSite = Get-PSProvider -PSProvider CMSITE | |
| Set-Location -Path "$($CMSite.Drives.Name):\" | |
| Invoke-CMQuery -Name 'All Non-Client Systems' |
This file contains hidden or 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
| Import-CMMaintenanceWindows.ps1 -MWsInputFile E:\Scripts\MW\Maintenance_Solution.csv -Delimiter ',' -Preview |
OlderNewer