To open the log file in a terminal window, use Get-Content: Get-Content "\\dc1\logs\($env.computername-Get-Date -f yyyy-MM-dd)-MSUpdates.log" Third-Party Windows Update PowerShell Module (PSWindowsUpdate) Start-WUScan -SearchCriteria "Type='Software' AND IsInstalled=0" | Out-File "\\dc1\logs\($env.computername-Get-Date -f yyyy-MM-dd)-MSUpdates.log" -Force You will need to replace dc1 in the command below with the name of the server on which you created the network share for storing Windows Update log files. Now we can output the results of Start-WUScan to a text file using Out-File. New-SMBShare –Name logs –Path 'c:\share\logs' -Description 'Windows Update logs' -FullAccess Everyone Let’s create a share on the local server for storing Windows Update logs generated by PowerShell. You can also add the -DownloadOnly switch to download the updates but not install them: Install-WUUpdates -Updates $Updates -DownloadOnlyĪnother useful command, Get-WUIsPendingReboot, shows you whether the device is waiting to be rebooted after installed updates. How to Manage Windows Update Using PowerShell (Image Credit: Russell Smith) Once you’ve performed a scan, you can use the object we created ($Updates) to install the updates with Install-WUUpdates: Install-WUUpdates -Updates $Updates Microsoft doesn’t have any comprehensive online documentation WindowsUpdateProvider but you can find information about the syntax you should use for -SearchCriteria in the API documentation here. The command below scans the device for updates that are not already applied to installed software: $Updates = Start-WUScan -SearchCriteria "Type='Software' AND IsInstalled=0" You can add filters to search for updates in specific categories, like software for example. It looks for available updates that apply to the device. The Start-WUScan cmdlet initiates a scan without installing any updates. You can list the available cmdlets in the module installed using Get-Command: Get-Command -Module WindowsUpdateProvider Microsoft’s Windows Update PowerShell provider (WindowsUpdateProvider) comes preinstalled in Windows Server 2019 and later versions of Windows. Microsoft’s Windows Update PowerShell provider
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |