Start Free Trial
Come for the solution, stay for everything else.
Start Free Trial
Running powershell scripts from ASP.NET
I am trying to run a powershell script from an ASP.NET page.
I have configured the application pool to run under a doman account identity but the powershell script appears to be running under the machine account.
When I add $env:username to the powershell script, it returns computername$
Any ideas where I am going wrong?
Microsoft IIS Web Server
8/22/2022 - Mon
Under what account is you AppPool running?
As Shaun is pointing out.. the scripts are going to run in the context of the AppPool that is running the website. I'm not an IIS expert, (I have some experience with it).. I believe you might be able to request credentials from the user and use those in your powershell scripts. I'm not sure how or if you could capture any kind of passthrough authentication.
This is do-able as per the example C# WinForm article below states... should be similar for ASP.NET.
The important thing to do is use the System.Management.Automati
on name space instead of calling a command.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
@Shaun - The application pool is running under a domain account.
@Dan - That namespace is being used to call the script and not a command.
ASKER CERTIFIED SOLUTION
Log in or sign up to see answer
Become an EE member today
7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Thanks heaps for that. Completely forgot but I had to do that for a website belonging to someone else.
Excellent... all working great now...
Plans and Pricing
Certified Expert Program
© 1996-2022 Experts Exchange, LLC. All rights reserved. Covered by US Patent