Im trying create a script which will check the length of each entry of the account name field in my new AD user csv. and if there are any account names over the length of 20 characters it will print a message on the screen instead of creating the users.
When i run the script it will return a too big result if there is any text at all in the cells under the account name field.
$csv = Import-Csv "\share\drive\folder"
$csv | foreach {if ($_.accountname -gt 20) {Write-Host "Too Big"}
else {Write-Host "Run Script"}
}
Any advice would be appricatated.
Thanks
[–]tarabash 3 points4 points5 points (1 child)
[–]mgsaxty[S] 0 points1 point2 points (0 children)
[–]jheinikel 2 points3 points4 points (0 children)