【问题标题】:Powershell Remote Computer SessionPowershell 远程计算机会话
【发布时间】:2017-04-22 06:13:52
【问题描述】:

我可以在总部域外的桌面上运行以下命令,但无法创建远程 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

【问题讨论】:

    标签: powershell


    【解决方案1】:

    您遇到的错误是什么?也许这是一个凭证,我有点想念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
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-06-25
      • 2017-03-08
      • 1970-01-01
      • 2012-04-14
      • 2014-04-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多