superdave67
IS-IT--Management
How can I run...
C:\WINDOWS\system32\windowspowershell\v1.0\powersh ell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -command ". 'C:\Program Files\Microsoft\Exchange Server\bin\getuserdata.ps1'"
from a Perl script?
I've tried:
system('C:\WINDOWS\system32\windowspowershell\v1.0\powersh ell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -command ". 'C:\Program Files\Microsoft\Exchange Server\bin\getuserdata.ps1'"');
but the process has trouble with the mixed quotes and such. The command itself runs fine from a CMD/DOS prompt, but when I attempt to execute it from the system() or exec() command, I get an error displayed on the webpage running the script.
WARNING: The following errors occurred when loading console C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1: Cannot load Windows PowerShell snap-in Microsoft.Exchange.Management.PowerShell.Admin because of the following error: No Windows PowerShell Snap-ins are available for version 1. Command ". 'C:\Program Files\Microsoft\Exchange Server\bin\getuserdata.ps1'" could not be executed because some Windows PowerShell snap-ins did not load.
I'm thinking it's an IIS permission issue with the command execution... but not quite sure how to verify or rule that out.
Thanks all,
Dave
C:\WINDOWS\system32\windowspowershell\v1.0\powersh ell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -command ". 'C:\Program Files\Microsoft\Exchange Server\bin\getuserdata.ps1'"
from a Perl script?
I've tried:
system('C:\WINDOWS\system32\windowspowershell\v1.0\powersh ell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -command ". 'C:\Program Files\Microsoft\Exchange Server\bin\getuserdata.ps1'"');
but the process has trouble with the mixed quotes and such. The command itself runs fine from a CMD/DOS prompt, but when I attempt to execute it from the system() or exec() command, I get an error displayed on the webpage running the script.
WARNING: The following errors occurred when loading console C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1: Cannot load Windows PowerShell snap-in Microsoft.Exchange.Management.PowerShell.Admin because of the following error: No Windows PowerShell Snap-ins are available for version 1. Command ". 'C:\Program Files\Microsoft\Exchange Server\bin\getuserdata.ps1'" could not be executed because some Windows PowerShell snap-ins did not load.
I'm thinking it's an IIS permission issue with the command execution... but not quite sure how to verify or rule that out.
Thanks all,
Dave