Open utterances-bot opened 1 year ago
If you have error about Executing policies, you can get over it with this command:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Hi, I tried first command : Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot | Out-File "C:($env.computername-Get-Date -f yyyy-MM-dd)-MSUpdates.log" -Force and I have got wrong name of log. Are You sure that command starting from "Out-File" is ok? I replace code to : Out-File "C:\$env:COMPUTERNAME-$(Get-Date -f yyyy-MM-dd)-MSUpdates.log" -Force in my console and after that name of log is correct. Correct me if I'm wrong.
what to do when thiw error occours?
"Add-WUServiceManager : The 'Add-WUServiceManager' command was found in the module 'PSWindowsUpdate', but the module cou ld not be loaded. For more information, run 'Import-Module PSWindowsUpdate'. At line:1 char:1
+ CategoryInfo : ObjectNotFound: (Add-WUServiceManager:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule"
@athapour84 use latest version of Powershell
Thanks for your reply. But it didn't work, even with the latest version of Powershell.
so I really like the idea of running updates with PowerShell. but my heart hit the floor when it installed Microsoft compatibly drivers over way better unsigned drivers I fought windows to install. it did this even with the windows update group policy's set. so you wouldn't know of A. a modified command that leaves them out. or B. Know where to get a set of GPO's to control this install method. Now I'm off to go do some damage control. thanks
# Trust the PSGallery repository
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
# Check if the PSWindowsUpdate module is installed
if (!(Get-Module -Name PSWindowsUpdate)) {
# If the module is not installed, install it using the Install-Module cmdlet
Install-Module PSWindowsUpdate
}
# Add the Microsoft Update service to the list of available update sources
Add-WUServiceManager -MicrosoftUpdate
# Install all available updates
Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot | Out-File "C:\($env.computername-Get-Date -f yyyy-MM-dd)-MSUpdates.log" -Force
Hi! Does it work with WSUS on corporate enviroment with this configuration? Specifically what does this line do? "Add-WUServiceManager -MicrosoftUpdate"
Thanks!
Hi! Does it work with WSUS on corporate enviroment with this configuration? Specifically what does this line do? "Add-WUServiceManager -MicrosoftUpdate"
Thanks!
I'd remove that line for a WSUS implementation. Other than that you should be set.
The correct setting for creating the log file should be: Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot | Out-File "C:\$env:COMPUTERNAME-$(Get-Date -f yyyy-MM-dd)-MSUpdates.log" -Force
Just a heads up, the syntax for the "$Computers" variable is incorrect on the 3rd example. Is should be $Computers = "pc2","pc3","pc4"
Using it the way it was written in the example $Computers = "pc2,pc3,pc4" makes PowerShell think it's a single computer named "pc2,pc3,pc4" rather than multiple computers.
Have the same issue as @athapour84
what to do when thiw error occours?
"Add-WUServiceManager : The 'Add-WUServiceManager' command was found in the module 'PSWindowsUpdate', but the module cou ld not be loaded. For more information, run 'Import-Module PSWindowsUpdate'. At line:1 char:1
Add-WUServiceManager -MicrosoftUpdate
I've also tried the latest power shell version but still the same issue. Any help would be much appreciated.
Hi! I followed the steps from this tutorial on a pretty barebones install created with the MSMG toolkit and whenever I run Get-WindowsUpdate or Install-WindowsUpdate there is no output. When ran with verbose output all Get-WindowsUpdate says is
VERBOSE: PCNAME (17/01/2023 20:28:49): Connecting to Windows Update server. Please wait...
All the other commands ran without any problem so I don't know what could be causing the issue. Thanks!
What's the best way to rip out the windows update service like you did?
Hi, i recommend using www.wuinstall.com its a command line tool and has no requirements
Install Windows Update Powershell
Having Fun with Technology
https://christitus.com/install-windows-update-powershell/