/build/static/layout/Breadcrumb_cap_w.png

Get Microsoft Updates using powershell with SDA post commands

You can update scripted or deployments with Microsoft updates via a power shell module.

You can install this ahead in your golden image and just run the last 2 lines of the PS script

Go to https://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc

download the Windows Update PowerShell Module

To install as post tasks:

Create an AutoIT script to xcopy the files to the PS modules directory:

RunWait(@ComSpec & " /c " & "xcopy.exe .\source\*.* C:\Windows\System32\WindowsPowerShell\v1.0\Modules /s /q /y","",@SW_MINIMIZE)


Zip that along with the files to install


I created a task group for the 2 items


First task copies the files


The second task installs and starts the windows updates. (check reboot required for this task)


The powershell script uppdate1.ps1: (line 1 installs; line2 adds Microsoft-updates as well; line 3 executes the job)

Import-Module PSWindowsUpdate
Add-WUServiceManager -ServiceID 7971f918-a847-4430-9279-4a52d1efe18d -Confirm:$false
Get-WUInstall -MicrosoftUpdate -IgnoreUserInput -AcceptAll -IgnoreReboot -Verbose

Here are the tasks within my custom deployment ( note I run the update after I install Office to get those updates also.)



Comments

  • tried the autoit script but doesnt copy the moules.. I place all the files in same folder. I'm I missing something? - psaussey 4 years ago
  • Should not be a flat directory. Look at the command window picture above. That was created with the "tree" command and the little lines signify the sub-directory branches.

    1. Create a temp folder on your desktop. open that folder in explorer

    2. In that folder place the autoit exe you complied.

    3. Create another folder called "source" in the folder. (the exe is looking for that folder as the copy source.) [.\source\*.*]

    4. Expand the zip file that you downloaded . In that expanded zip is a directory "PSWindowsUpdate" drag that to the source directory.

    5. Be in the folder you created in explorer. Highlight both the exe and the source folder.

    6. Right click on the two and choose "send to" - "compressed (zipped) folder"

    7. upload that zip and delete temp folder when all is well.

    The command will copy the entire folder PSWindowsUpdate and its contents to ...\modules because of the /S switch
    When done on the system drive you should get:
    C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate with the files in that - SMal.tmcc 4 years ago
    • Thanks . yes i figured that out. so now my post-install should work. is there a way to just install the cab files we tested and want as windows updates? - psaussey 4 years ago
  • you can modify the PS install command to call just certain updates also.
    this one says give me all {Get-WUInstall -MicrosoftUpdate -IgnoreUserInput -AcceptAll -IgnoreReboot -Verbose}

    I googled "pswindowsupdate command options"

    this post explains a lot of the options and you will find others to guide you to that option

    https://www.petri.com/manage-windows-updates-with-powershell-module - SMal.tmcc 4 years ago
  • I should just post anything i want to learn and SMal will come to the rescue! Awesome stuff ! Thanks so much. - jamie_kace 4 years ago
This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ