通过IP的方式建立PSSession

Import-Module PoshWSUS
Connect-PoshWSUSServer -WsusServer cnhzsrv09
Get-PoshWSUSClient | Select-Object -Property IPAddress, FullDomainName | Export-Csv -Path C:\aaa.csv -Force
$ip = Read-Host -Prompt "请输入IP地址"
Import-Csv -Path c:\aaa.csv | ForEach-Object {
    if($ip -eq $_.ipaddress) {
        Enter-PSSession -ComputerName $_.fulldomainname
    }
}

 

posted @ 2015-05-08 14:33  dongdonggeorge  阅读(532)  评论(0编辑  收藏  举报