PowerTip: Connect to PSSession if Availability is “None”

The Scripting Guys

Dr Scripto

Summary: Learn how to connect to a PSSession if its Availability is None.

Hey, Scripting Guy! Question Can I connect to a PSSession if its Availability is None?

Hey, Scripting Guy! Answer None means that no other session is connected to the PSSession,
          so if the State is Disconnected and the Availability is None, use the Connect-PSSession cmdlet to connect to it:

PS C:> Get-PSSession -ComputerName Server01 -Name Diag

Id Name     ComputerName    State         ConfigurationName     Availability

— —-    ————    —–         —————–     ————

  1 Diag    Server01        Disconnected  Microsoft.PowerShell          None

 

PS C:> Connect-PSSession | Get-PSSession -ComputerName Server01 -Name Diag

Id Name            ComputerName    State         ConfigurationName     Availability

— —-            ————    —–         —————–     ————

9 Diag            Server01        Opened        Microsoft.PowerShell     Available

 

The Scripting Guys
Dr Scripto

Follow Dr Scripto   

No Comments.