首页 > 代码库 > 远程使用Gpupdate(Hash,哈希)

远程使用Gpupdate(Hash,哈希)

function Start-GPUpdate
{
    param
    (
        [String[]]
        $ComputerName
    )
 
    $code = {    
        $rv = 1 | Select-Object -Property ComputerName, ExitCode
        $null = gpupdate.exe /force
        $rv.Exitcode = $LASTEXITCODE
        $rv.ComputerName = $env:COMPUTERNAME
        $rv 
    }
    Invoke-Command -ScriptBlock $code -ComputerName $ComputerName |
      Select-Object -Property ComputerName, ExitCode
 
}
 
From: http://www.pstips.net/gpupdate-on-remote-machines.html