So i can successfully import users to AD using the syntax below, but while it is running, i see 'errors' on accounts that already exists in AD. How do i get it to export those duplicates/ errors to a txt/csv file while its importing users?
import-csv ASI_Import.csv | foreach {new-ADuser -UserPrincipalName $_.userprincipalname -SamAccountName $_.samaccountname -Name $_.n
ame -DisplayName $_.displayname -GivenName $_.givenname -Surname $_.surname -Des
cription $_.description -Department $_.department -AccountPassword (ConvertTo-Se
cureString -AsPlainText "Password" -Force) -Enabled $false -Path 'OU=Import,DC=
ASI,DC=Local'}
I know i can change the layout size by increasing the height on buffer size, but would be nice to see the results in a txt file.
Any help would be appreciated!
Thanks,
JSS