Integration of Powershell from Active Perl ASP.Net

I am trying to invoke Powershell from ASP pages Active Perl but Poweshell is not getting invoked. Can someone help us here? Below is the code base.

ASP Code

<%@ Language=“PerlScript” %>

Test Site

<%
my $powershell = ‘C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe’;
my $mboxScript = ‘E:\inetpub\wwwroot\Site\test2.ps1’;
$result = $powershell -command $mboxScript;
$Response->Write($mboxScript);
$Response->Write($result);
%>

Test2

Powershell Code

echo HelloWorld

1 Like

HI pvmraghunandan,
Thank you for reaching out!
The team will look into this and advise accordingly.
Regards,
Lina

Backticks do not capture STDERR, so if your command simply fails to run, you won’t see anything. Capturing STDERR is probably your first avenue of approach to troubleshoot. A related discussion:

You could try redirecting STDERR to STDOUT for troubleshooting. There are more robust methods using additional modules.

1 Like

In the script, it has nothing except echo command. Couldn’t get STDERR point.

thanks, my issue has been fixed.

thanks for the awesome information.