$cred = Get-Credential -Message "Wprowadz poswiadczenia dla komputera serwer" $cred2 = Get-Credential -Message "Wprowadz poswiadczenia dla komputera DESKTOP-VNM5DM7" $sesion=New-PSSession -ComputerName serwer -Credential $cred $sesion2=New-PSSession -ComputerName DESKTOP-VNM5DM7 -Credential $cred2 Enter-PSSession -Session $sesion Exit-PSSession Get-PSSession Invoke-Command -Session $sesion -ScriptBlock { Get-WmiObject -Class Win32_operatingSystem } New-PSSession -ComputerName serwer -Credential $cred -Name "Backup session" Invoke-Command -Session (Get-PSSession -Name "Backup session") -ScriptBlock { Get-WmiObject -Class Win32_operatingSystem } $sesion | Remove-PSSession Get-PSSession | Remove-PSSession dir WSMan:\localhost\Shell Disconnect-PSSession -Session $sesion Connect-PSSession -Session (Get-PSSession -ComputerName serwer -State Disconnected) Receive-PSSession -ComputerName serwer Get-PSSession -ComputerName serwer -Name "Backup session" | Disconnect-PSSession $sesion $sesion2 Enable-PSRemoting -Force Receive-PSSession -Session $sesion