Created
January 8, 2017 19:34
-
-
Save jespernohr/3b2200986fde35653dbc76a86148711e to your computer and use it in GitHub Desktop.
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
#Scan for available updates | |
$ci = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession | |
$result = $ci | Invoke-CimMethod -MethodName ScanForUpdates -Arguments @{SearchCriteria="IsInstalled=0";OnlineScan=$true} | |
$result.Updates | |
#Install all available updates | |
$ci = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession | |
Invoke-CimMethod -InputObject $ci -MethodName ApplyApplicableUpdates | |
Restart-Computer; exit | |
#Get a list of installed updates | |
$ci = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession | |
$result = $ci | Invoke-CimMethod -MethodName ScanForUpdates -Arguments @{SearchCriteria="IsInstalled=1";OnlineScan=$true} | |
$result.Updates |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment