Tuesday, February 14, 2017

Powershell - Syntax notes

Powershell Split Operator
Had a problem with -split of a string variable that contained a "." (period) in it.  Discovered from this article that a period as a regular expression means 'any character', so you must escape the period with a "\".
For example:    $a,$b = $member.SamAccountName -split('\.')

See:   Article - Powershell Split Operator


No comments:

Post a Comment