通过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

    }

}

 

你可能感兴趣的:(session)