Calling PowerShell from Perl CGI executable


I have a legacy Perl CGI application executable running on a Windows Server 2102 machine. I am trying to modify the existing code to call a small PowerShell/PowerCLI script to connect to an instance of vCenter and get data for VMs that are running in the vCenter.

Here are some details on the system:

Perl Version 5.22.2
Komodo IDE, version 10.2.3, build 89902, platform win32-x86.
Built on Tue Jul 11 11:52:38 2017.

Here is an example of the code I am trying to run:

my $psVMdata = “E:/Production_Procedures/PS/Get-VMSdata_psVM_01.ps1”;
my $psVMOutput = qx/powershell.exe -command $psVMdata $name/;

When the code runs, the PowerShell script does not run. I am not sure why at this time.

I have successfully used this method to call the PowerShell scripts from other Perl executables. I am using back ticks for running that script Those executables are not CGI code for web pages however.

I have also been thinking that IIS may be blocking the PowerShell from running. I will also pursue that path as well.

If anyone has any ideas, please let me know.

Thank you,


I think you’re correct that it’s IIS blocking. Allowing IIS to run Powershell is a major security vulnerability, so it might actually be your security suite or Policy settings that are the point of trigger.