Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $servers = Get-Content C:\Tools\serverList.txt
- $creds = Get-Credential
- ForEach($server in $servers){
- $option1 = "/source wu"
- $option2 = "/contenttype criticalonly"
- $option3 = "/restart none"
- Copy-Item \\tkfiltoolbox\Tools\23649\3.0.37.2319\ '\\STITSNAPBLD105\C$\localbin' -Recurse -Force
- $var = invoke-command -ComputerName $server -ScriptBlock { param($option1,$option2,$option3) C:\localbin\3.0.37.2319\CritFix.exe $option1 $option $option3} -Credential $creds
- }
- <#$computernames = get-content c:\tools\Serverlist.txt
- foreach ($computername in $computernames)
- {
- $baseKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("LocalMachine",$computername)
- $key = $baseKey.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\")
- $subkeys = $key.GetSubKeyNames()
- $key.Close()
- $baseKey.Close()
- If ($subkeys | Where {$_ -eq "RebootPending"})
- {
- Write-Host "There is a pending reboot for" $computername
- Restart-Computer -ComputerName $computername -confirm -Force
- }
- Else
- {
- Write-Host "No reboot is pending for" $computername
- }
- }#>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement