Skip to content

Instantly share code, notes, and snippets.

@jleechpe
Created November 19, 2015 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jleechpe/a584a3625e15b2ea0f07 to your computer and use it in GitHub Desktop.
Save jleechpe/a584a3625e15b2ea0f07 to your computer and use it in GitHub Desktop.
[CMDLetBinding()]
param([string]$VMNameStr)
Write-Verbose "Splitting list of VM Names based on commas. Excess whitespace is trimmed. Empty names are omitted."
Write-Verbose "Use -OutVariable to assign to a variable if needed."
# Trim before calculating length to ensure no blank lines.
$VMNameStr.split(',').trim() | ? length -gt 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment