Been looking into a little ps1x script to run on a IIS webserver with Powershell ASP.
The scripts function will be to recycle an AppPool, but running into some issues. This is a dev server with a lot of AppPools running and they sometime crash the webapplication running, so setting up this to fast recycle the AppPool and move on.
The code snippet i use for a test runs just fine from Powershell ISE, but as soon as i move it over to the PS1x file in the inetpub folder and launch it via a browser, nothings happens. It just writes "ID" at the top of the page.
I have the AppPool the site is running as set up as the local administrator account, but also tried with my own (that is in the admin group).
So, unfortunately I've no idea what kind of runtime environment that sets up. My guess is that it's not setting things up the same as the console. Not every hosting application sets up the exact same environment – for example, it may not be using PSModulePath to do module auto-discovery. You'd need to contact whoever made PowerShell ASP and ask.