Guy*_*and 8 powershell azure powershell-remoting winrm
我使用winrm over SSL在Windows Azure上创建了一个Windows VM.
但是,我无法使用PowerShell脚本连接它.
当我运行以下内容时:
?Enter-PSSession -ConnectionUri https://myniceapp.cloudapp.net:5986
-Credential "hostname/username"
-SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck)
Run Code Online (Sandbox Code Playgroud)
我正在收到提示输入密码的提示,输入后我设法连接.
但是,当我尝试自动化它时,它总是返回"访问被拒绝"
$securePassword = ConvertTo-SecureString -AsPlainText -Force "password"
$cred = New-Object System.Management.Automation.PSCredential "hostname/username", $securePassword
?Enter-PSSession -ConnectionUri https://myniceapp.cloudapp.net:5986 -Credential $mycreds -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck)
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
编辑
完整错误如下所示:
Enter-PSSession:连接到远程服务器myniceaspp.cloudapp.net失败,并显示以下错误消息:访问被拒绝.有关详细信息,请参阅about_Remote_Troubleshooting帮助主题.
在行:1 char:1
+ Enter-PSSession -ConnectionUri https://myniceaspp.cloudapp ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
+ CategoryInfo:InvalidArgument:(https:// myniceaspp ... udapp.net:5986/:Uri)[Enter-PSSession],PSRemotingTransportException
+ FullyQualifiedErrorId:CreateRemoteRunspaceFailed
Oli*_*dry 17
最近有类似的问题.建议您仔细检查您正在连接的用户是否在远程计算机上具有适当的授权.
您可以使用以下命令查看权限.
Set-PSSessionConfiguration -ShowSecurityDescriptorUI -Name Microsoft.PowerShell
Run Code Online (Sandbox Code Playgroud)
在这里找到这个提示:
它为我修好了.
| 归档时间: |
|
| 查看次数: |
48539 次 |
| 最近记录: |