标签:password computer 输入密码 服务器 domain
$user = "domain\usrename"
$password = ConvertTo-SecureString -String "password" -AsPlainText -Force
$credential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $user, $password
$session = New-PSSession -computer ip -credential $credential
$result = Invoke-Command -Session $session -ScriptBlock {Add-PSSnapin vm*}
$result = Invoke-Command -Session $session -ScriptBlock {get-desktopvm -pool_id olanddesk}
$result
连接远程服务器使用
enter-pssession -computer ip -credential domain\username
本文出自 “备忘录” 博客,请务必保留此出处http://flybozhou.blog.51cto.com/818675/1834767
标签:password computer 输入密码 服务器 domain
原文地址:http://flybozhou.blog.51cto.com/818675/1834767