Powershell远程计算机会话
我可以从桌面在HQ域外运行以下命令,但无法创建远程Powershell会话。 我已经搜索了很多帖子,无法确定如何解决这个问题Powershell远程计算机会话,powershell,Powershell,我可以从桌面在HQ域外运行以下命令,但无法创建远程Powershell会话。 我已经搜索了很多帖子,无法确定如何解决这个问题 $TargetServer = 'RemoteComputer' Get-WmiObject -Namespace "root\cimv2" -Class Win32_Process -Impersonation 3 -Credential RemoteDomain\username -ComputerName $TargetServer 如果需要此功能,请注意,如果
$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
你的错误是什么?也许是凭证的问题,我有点怀念获取凭证的部分 您的用户需要在远程计算机上具有本地管理员权限,并且您需要为会话提供密码 通过执行以下操作可以输入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
如果这段代码不起作用,那么我们需要更多的信息