I have created few pssession using new-pssession.
I can see them using get-pssession.
Is there a trick to pipe get-pssession | invoke-command -session?
If I create the session using variable, $session1, $session2, $session3 I can use invoke-command -session $session1,$session2,$session3 but the previous pipe dont work as I expect.
The goal is to take a list from my internal ticketing server, and run the same command against 50+ server.
hope it clear
Doesn't look like you can pipe get-session to invoke-command, however this might be helpful
Example 9: Run a background job in a set of sessions
PS C:\> $s = New-PSSession -ComputerName (Get-Content Servers.txt) -Credential Domain01\Admin01 -ThrottleLimit 16
You cannot use local variables in remote sessions without setting the scope.
You cannot use all of PSRemoting (Invoke) unless you are an admin on the remote host.
So, you say these are workgroup systems. So, you set all the PSRemoting workgroup settings?
PowerShell remoting between two workgroup machines
Actually, I am an MSP, I take care of 250 different SMB.
Some of them as only few computer and a DC, some get exchange. Most of them are using Hyper-V host.
Here is another question related to this. Let take a customer with 2 server. Both set-up using SSL. So I had to put a hostname. Ex remote.contoso.com Because I want them both to be available I set-up the first one on port 45986 and second one on port 45987.
If I use invoke-command on those 2 computers at the same time, the result come back and a new column pscomputername is added. In both case, it remote.contoso.com. Internal machine name are different, DC and Hv1. Can we work around this?
You must be logged in to reply to this topic.