diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 3bcd9be0b..7b5b5c388 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -5,6 +5,10 @@ function Add-xSharePointUserToLocalAdmin() { [parameter(Mandatory = $true,Position=1)] [string] $UserName ) + if ($UserName.Contains("\") -eq $false) { + throw [Exception] "Usernames should be formatted as domain\username" + } + $domainName = $UserName.Split('\')[0] $accountName = $UserName.Split('\')[1] @@ -102,6 +106,10 @@ function Remove-xSharePointUserToLocalAdmin() { [parameter(Mandatory = $true,Position=1)] [string] $UserName ) + if ($UserName.Contains("\") -eq $false) { + throw [Exception] "Usernames should be formatted as domain\username" + } + $domainName = $UserName.Split('\')[0] $accountName = $UserName.Split('\')[1] @@ -162,6 +170,10 @@ function Test-xSharePointUserIsLocalAdmin() { [parameter(Mandatory = $true,Position=1)] [string] $UserName ) + if ($UserName.Contains("\") -eq $false) { + throw [Exception] "Usernames should be formatted as domain\username" + } + $domainName = $UserName.Split('\')[0] $accountName = $UserName.Split('\')[1]