# 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

-

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

gc cidway.txt | Set-ADUser -Clear pager


Get-Help Set-ADUser -Parameter Clear


Well, if you have your file wrong (and it looks like it so - mind trailing space) than no command will help you... ;) You can either fix file, or result of gc (e.g. gc | foreach { $_.Trim() } | Set-ADUser – BartekB Jul 30 '12 at 11:14 I've fixed the trailing spaces but receiving the same error: Set-ADUser : Cannot find an object with identity: 'glasshouseusr' under: 'DC=asuta,DC=co,DC=il'. At line:5 char:30 + gc c:\cidway.txt | Set-ADUser <<<< -Clear pager + CategoryInfo : ObjectNotFound: (glasshouseusr:ADUser) [Set-ADUser], ADIdentityNotFoundException + FullyQualifiedErrorId : Cannot find an object with identity: 'glasshouseusr' under: 'DC=asuta,DC=co,DC=il'.,Microsoft.ActiveDirectory.Management.Commands.SetADUser – Itai Ganot Jul 30 '12 at 13:03 Error is not the same - it stops on different user now. Unless you've changed txt file it means something is really wrong with this particular user identity. Identity can be DN, sAMAccountName, objectGUID or objectSid (Get-Help Set-ADUser -Parameter Identity). Make sure identities in txt file are correct and match any of attributes that I've mentioned and you are good to go. If you are not sure, just try Get-ADUser <youridentity> and see for yourself. :) – BartekB Jul 31 '12 at 9:55 I'm sorry, i missed your last answer but it solved my issue, so thanks. – Itai Ganot Jul 31 '12 at 16:50 You mean a script? Something along: Const ADS_PROPERTY_CLEAR = 1 foreach ($usr in Get-Content “C:\file.txt”)
("LDAP://cn="+$usr", ou=finance, dc=fabrikam, dc=com") objUser.PutEx ADS_PROPERTY_CLEAR, "pageNumber", 0 objUser.SetInfo }  - Yes i meant a script in Power Shell, something like this: Get-Content c:\cidway.txt | foreach-object { set-aduser -identity$_ -clear pager } – Itai Ganot Jul 29 '12 at 7:27