Ben Hart
asked on
powershell test/WhatIf question
I've written a script that will perform a get-mailbox, then add a new domain alias to each of the results. However I want to test it. I've seen google search results saying that this can be accomplished with a -WhatIf such as:
c:\>.\somescriptfile.ps1 -WhatIf
However that generate an error complaining about the whatif part.
Heres the code Im using:
Not sure what I could put a -whatif statement in here... I tried on a new line at the bottom but it failed.
c:\>.\somescriptfile.ps1 -WhatIf
However that generate an error complaining about the whatif part.
Heres the code Im using:
$users = get-mailbox
foreach ($a in $users) {$a.emailaddresses.Add("smtp:$($a.alias)@new.domain.com")}
$users | %{set-mailbox $_.Identity -emailaddresses $_.emailaddresses}
Not sure what I could put a -whatif statement in here... I tried on a new line at the bottom but it failed.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER