Hi guys
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).
https://paste.ofcode.org/kqKgYfb7ywGWFD9x3un26t
If i run this code
https://paste.ofcode.org/34qDvLuTEKatqMtxZEP9JV8
Then i can see the IIS drive is there (and not if i don’t load WebAdministration module in the top of the script.
Anyone have an idea of what is wrong and how to solve it.
EDIT: had to use PasteOfCode site, since the editor here doesn’t work with the code i pasted in.