troubleshooting Question

Powershell Needed to Handle/Report Errors etc.

Avatar of Darren Reevell
Darren ReevellFlag for United Kingdom of Great Britain and Northern Ireland asked on
Active DirectoryMicrosoft Server OSIT Administration
21 Comments1 Solution680 ViewsLast Modified:
Good afternoon...I'm a little new to Powershell so need a little advice from those more experienced than me.

I have written a simple import Powershell script to update User objects with information from an extracted CSV taken from our Oracle HR database:

Import-CSV "D:\Oracle\Scripts\TestSource.CSV" -Delimiter "," | Foreach-Object { Get-QADUser $_."mail" | Set-QADUser -description $_."description" -sn $_."sn" -givenName $_."givenName" -telephoneNumber $_."telephoneNumber" -mobile $_."mobile" -title $_."title" -Department $_."Department" -l $_."l" -streetAddress $_."streetAddress" -st $_."st" -ObjectAttributes @{employeeNumber=$_.employeeNumber;postalOfficeBox=$_.postalOfficeBox;comment=$_.comment}}

This works great, updates all the fields that I need..I would like to add something for error handling/reporting and perhaps a log file of all the objects that have been updated to.

Any/all advice and assistance is most welcome.
ASKER CERTIFIED SOLUTION
Chris Dent
PowerShell Developer
Join our community to see this answer!
Unlock 1 Answer and 21 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 21 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros