Today in class I took a question from the Active Directory Forums on PowerShell.com where I am a moderator. The user had an Excel spreadsheet containing the first and last names of his users, and a field for their pager numbers. He needed a way to test to see if the pager value in the spreadsheet matched the one in active directory. If not, he needed the number changed. Here is what I sent him: Import-Module ActiveDirectory ForEach ( $User in ( Import-CSV -Path C:\PS\Users.CSV )) { $Last = $User . Last $First = $User . first Get-ADUser -Filter '(Surname -eq $Last) -and (GivenName -eq $First)' | ForEach { If ( $User . OtherPager -ne $_ . Pager) { $_ | Set-ADObject -Replace @{OtherPager = " $( $User . OtherPager) " } } } } Assuming that he was u...
Welcome to the blogsite of MCTExpert. I am a Microsoft Certified Trainer. Here you will find the real questions that are asked to me by my students.