Get-WindowsUpdate

Welcome Forums General PowerShell Q&A Get-WindowsUpdate

Viewing 2 reply threads
  • Author
    Posts
    • #214629
      Participant
      Topics: 1
      Replies: 1
      Points: 15
      Rank: Member

      I am using the PSWindowsUpdate Module and have successfully used the cmdlet to return Windows Updates which need installing on a server.

      For example

      Get-WindowsUpdate –ComputerName Server1

      This then return the updates which need to be installed.

      Now rather than run this individually for my servers, I want to scale this out so I can run the cmdlet against multiple servers at the same time.

      I am looking for some advice on how to achieve this, I assume I would put the list of servers into a variable and possibly use the ForEach-Object

      Any advice would be greatly appreciated

    • #214632
      Participant
      Topics: 2
      Replies: 5
      Points: 17
      Rank: Member

      Invoke-Command -ComputerName (get-content c:\servers.txt) -ScriptBlock {get-windowsupdate}

      put your servers in a text file in c:\servers.txt

    • #214935
      Participant
      Topics: 1
      Replies: 1
      Points: 15
      Rank: Member

      Thanks for you reply robertrobert59. That failed to work but I adapted the code to this:

      Invoke-Command { Get-WindowsUpdate -ComputerName $Servers }

      I specified my servers in the variable $Servers

      This has worked

       

Viewing 2 reply threads
  • You must be logged in to reply to this topic.