I am doing a bulk import, setting or updating attribute6 on 1,000 users in AD.
I'm using the following Exchange commandlet to accomplish this:
[PS] C:\>set-mailbox -Identity user@company.com -CustomAttribute6 knruiz@nfp.com -WarningAction:SilentlyContinue -ErrorAction SilentlyContinue
The above command is repeated 1000 times and is auto generated.
My problem is that I want to generate a list of errors that I can feed back upstream to resolve errors such as:
- Missing user
- Ambiguous user
- Failure in setting attribute.
What I want to eliminate is the following text:
WARNING: The command completed successfully but no settings of 'company.com/Enterprise/Users/last, first' have been
modified.
What I've tried was setting the following -WarningAction:SilentlyContinue -ErrorAction SilentlyContinue
It seems that either the exchange commandlets don't support this, or perhaps because Exchange Powershell commandlets use "remoting" with stubs may be complicating the error handling.
Best Answer
You can try setting the warning action before running the command: