Combine Multiple Exchange PowerShell commands
Hi All,
I would like to combine below commands like a script,is there anyone to do for me ?thank you in advance
Add-DistributionGroupMember -Identity "Marketing Managers"
-Member adam@contoso.com
Remove-DistributionGroupMember -Identity "Marketing Managers" -Member
adam@contoso.com
Get-Mailbox -Identity testuser | Set-Mailbox -HiddenFromAddressListsEnabled $true
Get-Mailbox -Identity testuser | Set-CASMailbox -MAPIEnabled:$False
Get-Mailbox -Identity testuser | Set-CASMailbox -OWAEnabled:$False
Get-Mailbox -Identity testuser | Set-CASMailbox -ActiveSyncEnabled:$False
October 12th, 2012 2:02am
Copy and paste the above snippet into a txt file, rename it "myscript.ps1" and right click to run it.
Right click > select > 'Run with Powershell'
Or am I mis-taking your intent.Don't forget to mark your posts as answered so they drop off the unanswered post filter. If I've helped you and you want to show your gratitude, just click that green thingy.
Free Windows Admin Tool Kit Click here and download it now
October 12th, 2012 3:47am
Copy and paste the above snippet into a txt file, rename it "myscript.ps1" and right click to run it.
Right click > select > 'Run with Powershell'
Or am I mis-taking your intent.Don't forget to mark your posts as answered so they drop off the unanswered post filter. If I've helped you and you want to show your gratitude, just click that green thingy.
October 12th, 2012 3:47am
You can follow knuckle's suggestion to create the script, then run your script in Exchange Management shell.
Scripting with the Exchange Management Shell
http://technet.microsoft.com/en-us/library/bb123798.aspx
Thanks,
EvanEvan Liu
TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
October 15th, 2012 5:40am