User Tools

Site Tools


windows:scripting:ps_gpupdate

Domain wite update GPO using Powershell

gpupdate /target:computer gpupdate /force

#Get all computers
$cn = Get-ADComputer -filt *
 
#Get admin credentials
$cred = Get-Credential iammred\administrator
 
#Create sessions
$session = New-PSSession -cn $cn.name -cred $cred
#This will result in an error for each offline client
 
#Run command
icm -Session $session -ScriptBlock {gpupdate /force}
 
#Check if executed OK
icm -Session $session -ScriptBlock {Get-EventLog -LogName system -InstanceId1502 -Newest 1}
 
#remove session
remove-pssession $Session
windows/scripting/ps_gpupdate.txt · Last modified: 2017/08/18 13:21 by tplecko