Finally after many attempts, the line below does what it should. Now I need to get the correct syntax to run it with alternate credentials.
objShell.Run("%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -command C:\Create2007Mailbox.ps1 " + "'" + strCanonicalName + "'" + " " + "'" + strUser + "'")
All I want to do is launch the powershell shell (From a VBS script) as a different user.
The PowerShell Script "Create2007Mailbox.ps1" uses the enable-mailbox cmdlet to create a exchange 2007 mailbox. It’s launched from within a VBScript that creates new users accounts. The vbscript has imbedded credentials it uses to create the account, but the PowerShell script is executed under the current users credentials. How can I modify the line above to call the script as another user?
Any assistance would be greatly appreciated.