Question

Hi!

Some of my users have lastname firstname in AD and I'd like to clean this up. Tried with the following snippet:

get-QADUser user | Set-QADUser -DisplayName "$($_.FirstName + ' '+$_.LastName)"

but

get-QADUser user | select displayname

shows blank Displayname

What am I doing wrong here?

Was it helpful?

Solution

In this way it works

$user = get-QADUser user

Set-QADUser -identity $user -DisplayName ( $($user.firstname) + " " + $($user.lastname) )

In your way I think the pipe doesn't work as aspected. Maybe try to do a foreach-object

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top