繁体   English   中英

Powershell远程计算机会话

[英]Powershell Remote Computer Session

我可以在总部外的桌面上运行以下命令,但是无法创建远程Powershell会话。 我搜索了很多帖子,无法确定如何解决。

$TargetServer = 'RemoteComputer'
Get-WmiObject -Namespace "root\cimv2" -Class Win32_Process -Impersonation 3 -Credential RemoteDomain\username -ComputerName $TargetServer 

需要此功能,请注意,如果我登录到远程域中的管理服务器,则该命令将使用我的默认nt权限。

$TargetServerSession = New-PSSession -Credential RemoteDomain\username -ComputerName $TargetServer

您遇到什么错误? 也许这是一个凭证,我有点想念get-credential部分。

YourUser需要远程​​计算机上的本地管理员权限,并且您需要提供会话密码。

通过执行以下操作输入PSSession:

# * Define name of remote machine
$TargetServer = "RemoteComputer"

# * Get a password prompt for the user 'YourUser' and store the creds
$Cred = (Get-Credential YourDomain\YourUser)

# * Create a PSSession for the Remote Computer using the Credentials you just provided
$PSSession = new-pssession -Computer $TargetServer -Credential $Cred

# * Enter the session
Enter-PSSession $PSSession

如果此代码不起作用,那么我们需要更多信息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM