远程使用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
posted on 2014-06-13 17:46  momingliu11  阅读(638)  评论(0编辑  收藏  举报