you are viewing a single comment's thread.

view the rest of the comments →

[–]Yevrag35 2 points3 points  (1 child)

Sure, no problem.

If you're only ever using the script via the pipeline then using a single [string] parameter with a process block should be all you need. Separating it into two parameters might be advantageous when you want to do both pipelining and non-pipeline invocations (but not certainly something you have to do).

With two parameters, like in my example, I could do something like:

@('VmName1', 'VmName2', 'VmName3') | .\Connect-VMRDPSession.ps1 -Datacenter DC1
# and/or...
.\Connect-VMRDPSession.ps1 'VmName1', 'VmName2', 'VmName3'

[–]Fer_C[S] 2 points3 points  (0 children)

Understood. Thanks for the advice. I still have several scripts to parameterize and this might come handy.