使用wmic命令启用PSRemoting无法正常工作

时间:2016-10-17 11:03:05

标签: powershell remote-access

我尝试在本地计算机上使用wmic命令在远程PC上启用psremoting。

wmic /node:"ip" /user:admin process call create "powershell -ExecutionPolicy Bypass -File \\netshare\EnablePSRemote.ps1"

EnaplePSRemoting脚本包含以下内容:

Enable-PSRemoting -Force
Set-Item wsman:\localhost\client\trustedhosts *
Restart-Service WinRM 

我收到以下错误消息:

Set-WSManQuickConfig : Access is denied.

如果我使用mstsc登录远程电脑并在远程电脑上执行脚本,它会说:

WinRM has been updated to receive requests.
WinRM service type changed successfully.
WinRM service started.
Configured LocalAccountTokenFilterPolicy to grant administrative rights remotel
y to local users.

WinRM has been updated for remote management.
Created a WinRM listener on HTTP://* to accept WS-Man requests to any IP on thi
s machine.


WinRM Security Configuration.
This command modifies the TrustedHosts list for the WinRM client. The computers
 in the TrustedHosts list might not be authenticated. The client might send
credential information to these computers. Are you sure that you want to modify
 this list?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):

如果我确认是,则返回成功,我可以在没有任何远程PowerShell问题的情况下登录。

我在这里做错了什么?

0 个答案:

没有答案