Good Morning
I have got a CSV file containing over 500 users who have had job Title changes and i need to update the Job Title in Active Directory
I am currently using this Powershell Script:
Import-Module ActiveDirectory $data = import-csv -path C:\scripts\Titlestest.csv foreach ($user in $data){ Get-ADUser -Filter Name -eq $($user.fullname)' | Set-ADUser -Replace @{title = $($user.newtitle)} }In the Titletest.csv file, there is a column which has the users full name called fullname which displays the name like so, i.e 'Bob Smith' and there is also a column with their new Job Title called 'newtitle'
Running this script displays the following error
Get-ADUser : Error parsing query: 'Name -eq Bob Smith'' Error Message: 'syntax error' at "color:#ff0000;font-face:Lucida Console;font-size:x-small;">
At line:4 char:1
+ Get-ADUser -Filter Name -eq $($user.fullname)' | Set-ADUser -Replace @{ti ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ParserError: (:) [Get-ADUser], ADFilterParsingException
+ FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADFilterParsingException,Microsoft
.ActiveDirectory.Management.Commands.GetADUser
There is a bob smith in AD which i use as a test user, the CSV file at present only consists of this one user
I am wondering am i missing something simple here?
Barrie