Ajm*_*een 7 powershell remote-desktop access-denied powershell-remoting
我试图建立到另一个系统的远程连接并执行一些基本命令。
以下是我所做的步骤:
1. Invoke-Command -ComputerName COMPUTERNAME -ScriptBlock { Get-ChildItem C:\ } -credential USERNAME.
2. Invoke-Command -ComputerName COMPUTERNAME -ScriptBlock { Get-ChildItem C:\ } -credential $Credentials.
3.Invoke-Command -ComputerName COMPUTERNAME -ScriptBlock { Get-ChildItem C:\ }
在所有情况下,我们都收到拒绝访问错误:
Access is denied. For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : OpenError: (:) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionStateBroken
Run Code Online (Sandbox Code Playgroud)
从MSDN:
通过右键单击 Windows PowerShell 快捷方式并选择以管理员身份运行,以管理员身份启动 Windows PowerShell。
WinRM 服务默认配置为手动启动。您必须将启动类型更改为自动,并在要使用的每台计算机上启动该服务。在 PowerShell 提示符下,您可以使用以下命令验证 WinRM 服务是否正在运行: get-service winrm 输出中状态属性的值应为“正在运行”。
要配置 Windows PowerShell 进行远程处理,请键入以下命令:Enable-PSRemoting –force
在许多情况下,您将能够使用其他域中的远程计算机。但是,如果远程计算机不在受信任域中,则远程计算机可能无法验证您的凭据。要启用身份验证,您需要将远程计算机添加到 WinRM 中本地计算机的受信任主机列表中。为此,请键入: winrm s winrm/config/client '@{TrustedHosts="RemoteComputer"}' 这里,RemoteComputer 应该是远程计算机的名称,例如:winrm s winrm/config/client '@{TrustedHosts= “CorpServer56”}'
你应该检查是否 winrm正在运行。还将您的远程主机添加到受信任的主机列表(或您的本地机器)。
希望有帮助。
| 归档时间: |
|
| 查看次数: |
30398 次 |
| 最近记录: |