Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

error logging question

$
0
0

Hi all

 

Using the following I intend to populate the telephone number field in AD:

 

Import-Csv C:\test.csv | ForEach-Object {

Set-ADUser -Identity $_.samAccountName -OfficePhone $_.telephoneNumber -MobilePhone $_.MobilePhone

}

 

Odds are the HR system that dumped out the csv has some incorrect samaccountname's.  Can you edit my code above to log the accounts not found to csv for me?  Im not sure how to error log that.


Viewing all articles
Browse latest Browse all 6937

Trending Articles