Greetings,
I'm trying to create a simple ps script that will clear telephone number from a large user group in AD, pulling from a csv file however keep getting this error and not sure where or why it is failing...I'd appreciate the feedback or any assistance you could provide. Cheers.
$users = Import-Csv -Path C:\user.csv
foreach ($user in $users) {
Get-ADUser $user.SamAccountName -Properties * -SearchBase 'ou=Users,DC=cotm,DC=local' | Set-ADUser -Clear telephone
}
ERROR:
Get-ADUser : A positional parameter cannot be found that accepts argument 'fletterman'.
At C:\phone.ps1:5 char:1
+ Get-ADUser $user.SamAccountName -Properties -SearchBase 'ou=...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-ADUser], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.ActiveDirectory.Management.Commands.GetADUser
Get-ADUser : A positional parameter cannot be found that accepts argument 'gramone'.
At C:\phone.ps1:5 char:1
+ Get-ADUser $user.SamAccountName -Properties -SearchBase 'ou=...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-ADUser], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.ActiveDirectory.Management.Commands.GetADUser