PS C:\Users\xxxx\source\repos\Datacenter> Get-PSSession
Id Name ComputerName ComputerType State ConfigurationName Availability
5 WinRM5 black-dove RemoteMachine Opened Microsoft.PowerShell Available
4 WinRM4 china RemoteMachine Opened Microsoft.PowerShell Available
PS C:\Users\xxxx\source\repos\Datacenter> Get-PSSession -ComputerName “china”
PS C:\Users\xxxx\source\repos\Datacenter>
Hi,
Can anyone help on this please?
Why is nothing being returned??? i have tried ‘china’ and china with no quotes and no session gets returned even though those sessions are clearly active in get-pssession
Olaf
August 15, 2019, 5:30am
2
Try …
Get-PSSession | Where-Object {$_.ComputerName -eq ‘china’}
[quote quote=170863]Try …
<textarea class="ace_text-input" style="opacity: 0; height: 18px; width: 6.59781px; left: 44px; top: 0px;" spellcheck="false" wrap="off"></textarea>
Get-PSSession | Where-Object {$_ .ComputerName -eq 'china' }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[/quote]
Thanks that works , but i am really confused as this seems a long way of doing it? should -computername not work?
Olaf
August 15, 2019, 5:38am
4
The parameter -ComputerName is not a filter - it’s a request for the cmdlet to run on the remote computer you specified.