Invoke-Command2 Using Port 0 on fresh install? #8500
Unanswered
malcolmcarey
asked this question in
Q&A
Replies: 1 comment
-
Hi @malcolmcarey, Thanks for bringing this to our attention. Yes, I see it as a bug. The idea is to keep the default behaviour of the command. So, on a new installation if you don't change the Therefore I have opened the issue #8501 and submitted a PR with a fix #8502 Do you mind trying the new version once @potatoqualitee generates a new version? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Wanted to see if anyone else has experienced this. I'm a new user here, never been a part of an open source project before and new to powershell.
I installed the module using Install-Module -Name dbatools
I then tried to run a command on a remote computer hosting a SQL Server instance, which is both on the same domain as me and I'm an administrator on the machine. See the results below (note I blocked out my server name and IP, the last line is really the important one).
Get-DbaNetworkConfiguration -Sqlinstance 'myServer' -Verbose
So a port of 0 is being passed to the Invoke-Command2 function here.
In the code for Invoke-Command2, a port of 0 appears to be allowed. However, I don't really know how 0 is being passed as my port here, I would have assumed it would be $null. Alas, the error message indicates otherwise:
However, Invoke-Command requires the port number to be at least 1, at least on my machine. You can replicate that error message on your own machine just by trying to run Invoke-Command with -Port 0
I set my default port using:
Set-DbatoolsConfig -FullName psremoting.pssession.port -Value 5985
After that, running dbatools commands that use Invoke-Command 2 work just fine.
Not sure if this qualifies as a bug or not? I feel like it should, and I would vote for having the default psremoting.pssession.port be 5985, the same default port that is assigned when creating a new PSSession without specifying a port.
Beta Was this translation helpful? Give feedback.
All reactions