I'm back, yesterday was a bad day, I lost a build machine on vCenter and the guy who built it was left, he even didn't remember how to build it so a big fight happened to build up this build machine.
Everything is on track now so I'm back with the little problem of installation msu file on remote machine.
First, we have to extract the cab file from msu file
winrs.exe -r:$vmIP -u:$VmUser -p:$VmPwd wusa.exe $kbFile /extract:$kbFolder
Then we will install the cab file with dism tool
winrs.exe -r:$vmIP -u:$VmUser -p:$VmPwd dism.exe /Online /Add-Package /NoRestart /PackagePath:$kbcabFile
There is a note here if you go through a list of KBs then you will use a loop, running winrs in a loop might cause an execution hang because of the stdin. Provide the $null output to this command
$null | winrs.exe -r:$vmIP -u:$VmUser -p:$VmPwd dism.exe /Online /Add-Package /NoRestart /PackagePath:$kbcabFile
It's Friday, a light topic for the weekend! Have fun all!
Everything is on track now so I'm back with the little problem of installation msu file on remote machine.
Use Case:
I need to run window upgrade (install Windows KB msu files) for some of my template machines. If we have SystemCenter or other infrastructure management tool should be a flash to do that. I'm working on Jenkins to run this automation so I decide to use Powershell.Solution:
As I can use Powershell for remote call so I will use Invoke-Command for msiexec (for msi) or wusa (for msu). However, life is not so simple as wusa can't be triggered by Invoke-Command so we have to use WinRS (Windows Remote Shell).First, we have to extract the cab file from msu file
winrs.exe -r:$vmIP -u:$VmUser -p:$VmPwd wusa.exe $kbFile /extract:$kbFolder
Then we will install the cab file with dism tool
winrs.exe -r:$vmIP -u:$VmUser -p:$VmPwd dism.exe /Online /Add-Package /NoRestart /PackagePath:$kbcabFile
There is a note here if you go through a list of KBs then you will use a loop, running winrs in a loop might cause an execution hang because of the stdin. Provide the $null output to this command
$null | winrs.exe -r:$vmIP -u:$VmUser -p:$VmPwd dism.exe /Online /Add-Package /NoRestart /PackagePath:$kbcabFile
It's Friday, a light topic for the weekend! Have fun all!
Comments
Post a Comment