码迷,mamicode.com
首页 > Windows程序 > 详细

远程连接windows命令行

时间:2020-02-13 21:14:31      阅读:865      评论:0      收藏:0      [点我收藏+]

标签:art   shel   ESS   local   允许   enter   运行   concat   core   

远程连接命令行

win2019 core 安装,如何远程连接
系统装完后,没图形界面,不会用了对吧?....没关系,看完下面的就会了...

先登录远程服务器


========================================
远程cmd下

#在命令行里运行
powershell

#看一下ip地址,并记ip地址
ipconfig

#确认WinRM是启动的
Get-Service WinRM | start-Service

#最后,你需要允许远程运行PowerShell
Enable-PSRemoting


========================================
本地cmd下

powershell

# 确认WinRM在你的电脑上是启动的
Get-Service WinRM | Start-Service

# 非域控环境下添加trusted host(如果是域控把"*"改为域名即可)
Set-Item WSMan:\localhost\Client\TrustedHosts "*" -Force

# 试一下连接远程服务器的powershell,记得在弹出窗里输入远程服务器的帐号密码
Enter-PSSession 远程ip -Credential (Get-Credential)

例子
PS C:\Users\Administrator> Enter-PSSession 192.168.3.27 -Credential (Get-Credential)


好了,现在已经可以使用远程服务器的powershell,但sconfig在远程是不能调用的哦....

 

 

 

 

==========================================

 server-manager连接远程机器

 

 在
PS C:\Users\Administrator> Get-Item WSMan:\localhost\Client\TrustedHosts | select name,value | format-list


Name : TrustedHosts
Value :

 

PS C:\Users\Administrator> Set-Item wsman:\localhost\Client\TrustedHosts "WIN-PPI5UFNN25A" -Concatenate -Force
PS C:\Users\Administrator> Get-Item WSMan:\localhost\Client\TrustedHosts | select name,value | format-list


Name : TrustedHosts
Value : WIN-PPI5UFNN25A


PS C:\Users\Administrator> cmdkey /add:WIN-PPI5UFNN25A /user:administrator /pass:password1

远程连接windows命令行

标签:art   shel   ESS   local   允许   enter   运行   concat   core   

原文地址:https://www.cnblogs.com/createyuan/p/12304976.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!