Forum Discussion

Alan2022's avatar
Alan2022
Iron Contributor
May 31, 2022

Re: Run Windows Updates with Powershell Remotely

Hi dmarquesgn

I think the best approach in here is using WSUS in your Company.
So no need for PowerShell to do that.

3 Replies

  • dmarquesgn's avatar
    dmarquesgn
    Iron Contributor
    Thanks for the tip.
    I would like to avoid WSUS, as it also has some challenges, and at the same time I would learn more on Powershell.

    Meanwhile I was already able to use a command to update remotely, now I need to deal with errors and logging, which is not so good at the moment.

    Set-Item WSMan:\localhost\Client\TrustedHosts –Value * -Force
    $Script = {Get-WindowsUpdate -KBArticleID KB4535680 -AcceptAll -Install -Verbose | Out-File C:\Temp\PSWindowsUpdate.log}
    Invoke-WUjob -ComputerName <computername> -Script $Script -Confirm:$false -RunNow
    • andrefilipe90's avatar
      andrefilipe90
      Copper Contributor

      dmarquesgn 

       

      great topic, would you mind sharing the code you got so far and some details of how it works?

       

      cheers.

      • dmarquesgn's avatar
        dmarquesgn
        Iron Contributor

        andrefilipe90 

        Hi, how are you?

        To be honest, I didn't developed much more on that, as we turned into a low cost but very effective tool for that goal, which was PDQ.

         

         

Resources