Is it possible to clear the Pager field in AD users & computer using a command?

I need to run though a list of 100 user names and clear their Pager field, can it be done with Power Shell? The input of the file name which includes the user names looks like this: itaig haruth geloos fested


Solution 1:

If you want/ can use AD Module than this should be no-brainer:

gc cidway.txt | Set-ADUser -Clear pager

Read help:

Get-Help Set-ADUser -Parameter Clear

... for more info.

Solution 2:

You mean a script?

Something along:

Const ADS_PROPERTY_CLEAR = 1 
foreach ($usr in Get-Content “C:\file.txt”)
{
Set objUser = GetObject _
   ("LDAP://cn="+$usr", ou=finance, dc=fabrikam, dc=com") 

objUser.PutEx ADS_PROPERTY_CLEAR, "pageNumber", 0
objUser.SetInfo
}