Last active
November 8, 2015 21:57
-
-
Save bundyfx/b001299b390df28eb11e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([string]$VMNameStr) | |
0..(($VMNameStr -split ",").GetLength(0) -1) | % {Set-Variable "VMName$Psitem" -Value ($VMNameStr -split ',')[$Psitem] -PassThru } | |
#The VMNameStr param is intended to be taken as a single string rather than the conventional array of strings ([String[]]). | |
#Take values from param, split those and turn it in a range, Foreach of those create a new variable based on the number coming across the pipeline. | |
#The value of those variables will be the original array split calling the position index of the current item in the pipeline (Passthru to display this on the screen). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment