I am using a script to update the data of Active Directory users
Import-Csv -Path $Path | foreach-object {Set-ADUser -Identity ($_.user) -Department $_.Department -Title $_.Title -Company $_.Company -MobilePhone $_.MobilePhone ...etc (the required data to modify)}
I want the script to write the errors in the update of an "x" user's, to see whose user wasn't updated.
I'm creating a C# app to write a personalized script, and still need to make the error log.
The idea is to create this log in a specified path. I don't know if this can be made in the script it self.
I'm using this PowerShell method I have found here:
PowerShell ps = PowerShell.Create();
ps.AddScript(script);
IAsyncResult result = ps.BeginInvoke();
// do something else until execution has completed.
// this could be sleep/wait, or perhaps some other work
while (result.IsCompleted == false)
{
//think i can make that here, but can´t see how
}
MessageBox.Show("Complete");