我试图从我的机器“A”login到Windows 2008服务器“C”。 在“B”之间有一台机器,用作运行Windows Server 2008的跳转箱,并运行“支持SSH的PowerShell PowerShell Access for Windows(powershellserver.com)”
我正在从机器“A”对机器B执行ssh。 从机器BI能够创buildPS机器到C机,但无法进入会话,下面是我所看到的错误。
PS C:\Users\Documents> New-PsSession -Credential $mycreds -Computername xxxx Id Name ComputerName State ConfigurationName Availability -- ---- ------------ ----- ----------------- ------------ 228 Session228 xxxx Opened Microsoft.PowerShell Available PS C:\Users\Documents> Get-PSSession | Remove-PSSession PS C:\Users\Documents> $session = New-PsSession -Credential $mycreds -Computername xxxx PS C:\Users\Documents> enter-pssession $session enter-pssession : The method or operation is not implemented. At line:1 char:1 + enter-pssession $session + ~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotImplemented: (:) [Enter-PSSession], PSNotImplementedException + FullyQualifiedErrorId : NotImplemented,Microsoft.PowerShell.Commands.EnterPSSessionCommand
当我使用RDPlogin到机器B,然后在机器C上进行会话时,它工作正常。 那么为什么它不是从ssh会话工作。
让我知道是否需要进一步澄清。
提前致谢!
你必须使用下面的命令
$s = New-PSSession -ComputerName Server02 -Credential Domain01\User01 Invoke-Command -Session $s -ScriptBlock {commands....}