Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Error Handling during Import from CSV (Using Set-QADUser)

$
0
0

Folks,

I'm using the Quest Set-QADUser powershell along with the Import-CSV command (see below for syntax) and I am having some issues with error handling that I need advice on. Essentially the import works fantastic as long as the users in the source file are present in the AD..if however, they are not present the powershell import stops and no more information is updated.

I would like to know how I get the powershell to log the error to a log file and then continue to the next account in the import (CSV) file...

######################################

# Use Quest ActiveRoles Active Directory Powershell CMDLETs

Add-PSSnapin Quest.ActiveRoles.ADManagement

#Get Date

$now = [datetime]::now.ToString('yyyy-MM-dd')

IMPORT-CSV d:\oracle\scripts\pilot.csv | Set-QADUser -Identity {_.mail} | Out-File -FilePath ("d:\oracle\changelog\changelog_$now.log") -encoding ASCII -append -width 1000

########################################


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>