Set-ADUser from pipe

by Mar 4, 2015

Hi guys,

I'm wanting to clear out any titles that staff have in AD so they are all blank.

I'm testing the command with this first:

Get-ADUser -Identity testuser -Properties Name, title | select name, title | where title | Set-ADUser -Title ""

This is giving me the error:

Set-ADUser : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline
At line:1 char:91
+ …  where title | Set-ADUser -Title ""
+                    ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (@{name=Test User; title=again}:PSObject) [Set-ADUser], ParameterBindingException
    + FullyQualifiedErrorId : InputObjectNotBound,Microsoft.ActiveDirectory.Management.Commands.SetADUser

If I gm after the "where" it confirms it is an ADUser object.

Any help would be appreciated 🙂



I eventually will try something like this after I get the above command working:

Get-ADUser -filter * -Properties Name, title | select name, title | where title | Set-ADUser {$_.Title ""}

Though I'm still trying to figure out when and where I can use $_ and curly braces..? and if I should use

Perhaps it would be easier to just do it across the board for all users rather than filtering down to just the users that have a title currently.. will take longer but there are less than 500 users.