Powershell allows multiple assignment of variables and treats almost everything like an array or list. This means that instead of doing something like this:
$input = "foo.bar.baz" $parts = $input.Split(".") $foo = $parts $bar = $parts $baz = $parts
You can simply do this:
$foo, $bar, $baz = $input.Split(".")
Since Powershell treats assignments in this manner like lists, if there are more values in the list than items in your list of variables to assign them to, the last variable becomes an array of the remaining values. This means you can also do things like this:
$foo, $leftover = $input.Split(".") #Sets $foo = "foo", $leftover = ["bar","baz"] $bar = $leftover # $bar = "bar" $baz = $leftover # $baz = "baz"