Orlando Gomez
asked on
run multiple commands Exchange powershell
I have an Exchange powershell file .ps1 named forwardoff.ps1 which has the following commands. I right click on the .ps1 files and run with powershell but it errors out. When I run manually thru exchange PowerShell each command one at a time they run successfully. What am I doing wrong.? I need to be able to see the result which is why I added the "press any key to continue"
Set-Mailbox user1 -ForwardingAddress $Null;
Set-Mailbox user2 -ForwardingAddress $Null;
Set-Mailbox user3 -ForwardingAddress $Null;
Set-Mailbox user4 -ForwardingAddress $Null;
Read-Host -Prompt "Press Enter to continue"
Set-Mailbox user1 -ForwardingAddress $Null;
Set-Mailbox user2 -ForwardingAddress $Null;
Set-Mailbox user3 -ForwardingAddress $Null;
Set-Mailbox user4 -ForwardingAddress $Null;
Read-Host -Prompt "Press Enter to continue"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Will.