question

vasuM-3432 avatar image
1 Vote"
vasuM-3432 asked rosenqvist answered

start-wuscan cmdlet is not avialble to run on few Windows 10

Hi,

We have few PCs where start-wuscan PowerShell cmdlet is not available to run. These PCs run 1909, 20H1, 20H2 builds. Wondering how is this cmdlet got broken or missing, and second how to restore it back ?

PS C:\WINDOWS\system32> start-wuscan
start-wuscan : The term 'start-wuscan' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1
+ start-wuscan
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (start-wuscan:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException


51593-image.png



windows-server-powershell
image.png (49.2 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,
did you include WindowsUpdateProvider? (Import-Module WindowsUpdateProvider)

0 Votes 0 ·
MotoX80 avatar image
0 Votes"
MotoX80 answered

Check your $env:PSModulePath and verify that it contains C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

Verify that this file exists: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\WindowsUpdateProvider\WindowsUpdateProvider.psd1


 (get-module -ListAvailable windowsupdateprov*).path
 (get-module -ListAvailable windowsupdateprov*).ExportedCommands

PS C:\WINDOWS\system32> (get-module -ListAvailable windowsupdateprov*).path
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\WindowsUpdateProvider\WindowsUpdateProvider.psd1
PS C:\WINDOWS\system32> (get-module -ListAvailable windowsupdateprov*).ExportedCommands

Key Value


Get-WUAVersion Get-WUAVersion
Get-WULastInstallationDate Get-WULastInstallationDate
Get-WULastScanSuccessDate Get-WULastScanSuccessDate
Get-WUIsPendingReboot Get-WUIsPendingReboot
Install-WUUpdates Install-WUUpdates
Start-WUScan Start-WUScan





5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

abbodi86-0005 avatar image
2 Votes"
abbodi86-0005 answered abbodi86-0005 edited

The module is removed in version 2004 (20H1), and thus 20H2 too
https://github.com/MicrosoftDocs/windows-powershell-docs/issues/139#issuecomment-648125918

you either have to rely on the manual commands to run the scan
e.g.

 $Session = new-object -com "Microsoft.Update.Session"
 $ctr = "(IsInstalled=0 and DeploymentAction=*) or (IsInstalled=1 and DeploymentAction=*) or (IsHidden=1 and DeploymentAction=*)"
 $Result = $Session.CreateupdateSearcher().Search($ctr).Updates
 $Result | Select Title,Identity,IsHidden,LastDeploymentChangeTime,KBArticleIDs | Format-List -Property Title,@{l='UpdateID';e={$_.Identity.UpdateID}},@{l='PublishedDate';e={$_.LastDeploymentChangeTime.ToString('yyyy-MM-dd')}},@{l='KBArticle';e={$_.KBArticleIDs}},IsHidden

or install external module PSWindowsUpdate

 Install-PackageProvider -Name NuGet -Force
 Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
 Install-Module -Name PSWindowsUpdate


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

IanXue-MSFT avatar image
0 Votes"
IanXue-MSFT answered

Hi,

Check if the module WindowsUpdateProvider and the file C:\Windows\System32\WindowsPowerShell\v1.0\Modules\WindowsUpdateProvider\WindowsUpdateProvider.psd1 exist. If yes, please help to post the contents of the psd1 file.

Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

rosenqvist avatar image
3 Votes"
rosenqvist answered

Please bring back the "WindowsUpdateProvider" module

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.