Я хочу отключиться от удаленного PowerShell, подключенного к Office365, и подключиться позже.
Попробовал команду Disconnect-PSSession
, но выдает ошибку.
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
.
.
.
.
Disconnect-PSSession $Session
(Перенаправляет на https://nam04b.ps.compliance.protection.outlook.com/powershell-liveid?PSVersion=4.0)
Вывод, который я вижу:
disconnect-pssession : Disconnect-PSSession operation failed for runspace Id = 613e8071-b691-4365-84dc-2d65c21ea2fa
for the following reason: The disconnection operation is not supported on the remote computer. To support
disconnecting, the remote computer must be running Windows PowerShell 3.0 or a later version of Windows PowerShell.
At line:1 char:15
+ get-pssession|disconnect-pssession
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ([PSSession]Session1:PSSession) [Disconnect-PSSession], RuntimeExcepti
on
+ FullyQualifiedErrorId : PSSessionDisconnectFailed,Microsoft.PowerShell.Commands.DisconnectPSSessionCommand
Локально у меня работает Powershell версии 4. И Get-PSSessionConfiguration
показывает PSVersion 4. на сервере. Любая помощь приветствуется