0
我創建了一個與$remote = New-PsSesion ...
的會話,我想稍後以交互方式使用它。Enter-PSSession與現有會話
我試過Enter-PSSesion -Session $remote
但它報錯Enter-PSSession:使用指定的命名參數無法解析參數集。使用Id
參數時會發生同樣的情況。
===編輯===
> New-PSSession
Id Name ComputerName ComputerType State ConfigurationName Availability
-- ---- ------------ ------------ ----- ----------------- ------------
1 Session1 localhost RemoteMachine Opened Microsoft.PowerShell Available
> etsn -Id 1
Enter-PSSession : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ etsn -Id 1
+ ~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Enter-PSSession], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.EnterPSSessionCommand
> $host
Name : ConsoleHost
Version : 5.1.14393.1198
InstanceId : ab8e55cd-69ae-4587-a70a-c66f197028a4
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : sr-Latn-RS
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
您是否使用任何其他參數?我只是在我的測試環境中測試它,並且它都正常工作。在我的環境下輸出以下評論。此外,只需重新閱讀您的問題,看起來您在New-PSSession中缺少S。你有New-PSSesion。 –
PS C:\窗口\ system32> $ dc1remote =新-的PSSession -VMName DC1 -Credential timhaintz \管理員 PS C:\窗口\ system32>輸入-的PSSession $ dc1remote [DC1]:PS C:\用戶\ Administrator \ Documents>退出 PS C:\ WINDOWS \ system32> Enter-PSSession -Session $ dc1remote [dc1]:PS C:\ Users \ Administrator \ Documents>退出 –
什麼是您的PS版本,您可以顯示什麼你完整的會話定義看起來像......如果你願意的話,可以擦掉。 – Matt