Created
November 2, 2015 14:02
-
-
Save ctigeek/28bb4ce00c9d75a0accf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Copy-WUPowershellModule($computerName) { | |
| $remotePath = "\\$($computerName)\c$\Windows\System32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate" | |
| $localPath = "C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate" | |
| if (! (Test-Path $remotePath )) { | |
| Write-Host "Copying powershell module." | |
| Copy-Item $localPath -Destination $remotePath -Recurse -Force | |
| } | |
| $command = { | |
| ##Add the Microsoft Update service | |
| Add-WUServiceManager -ServiceID 7971f918-a847-4430-9279-4a52d1efe18d -Confirm:$false | |
| } | |
| Invoke-Command -ComputerName $computerName -ScriptBlock $command | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment