【Poweshell】Powershell开启远程登录的方法

时间:2023-01-27 19:55:00

在服务端和客户端分别运行如下两条PS命令

Enable-PSremoting

set-item wsman:localhost\client\trustedhosts -Value 10.1.1.* -Force

#Change '10.1.1.*' to your network string

#Client  uses 'Enter-PSSession 10.1.1.56 -Credential kaedeleo\wei.yuan' to connect.


把其中的10.1.1.*换成你的网段或者就用*。

在客户端运行如下命令(账号换成自己的),输入密码:

【Poweshell】Powershell开启远程登录的方法

也可以把密码放进脚本内,以后再介绍。

【Poweshell】Powershell开启远程登录的方法

这就是连接成功了。