I'm trying to run this simple script:
import-module activedirectory add-pssnapin microsoft.exchange.management.powershell.admin add-adgroupmember -identity "gbl-ap-user-aw users" -member "atest1" set-casmailbox -identity "atest1@mydomain.com" -activesyncenabled $true
When I simply double-click it, it runs fine. However, when I attempt to run it from within another script (like "powershell c:\myscript.ps1) it says "The Windows Powershell snap-in 'microsoft.exchange.management.powershell.admin' is not installed on this machine."
I know that the snap-in is not available for the 32bit version of powershell, so I tried running the 64bit version like so:
start-process "c:\windows\system32\windowspowershell\v1.0\powershell.exe" "c:\myscript.ps1"
But I still receive the same error. Why won't it load the snap-in?