I'm an app engineer and I've set up an application dashboard using SQL Server and PHP on IIS to help monitor the app vitals. I also script a lot of processes using PowerShell and I'm trying to get to where I can run a PowerShell Script from my site and have that script loop through several different remote servers to perform tasks. I already built the form in PHP and the form correctly $_POST
the environmental variable to the PS script but when it reaches out to the remote server I get the error:
test-path : Access is denied At C:\scripts\functions\scriptUser.ps1:69 char:6 + if(test-path \$server\e$\Path\to\file){ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : PermissionDenied: (\SERVER1...\path\to\file:String) [Test-Path], UnauthorizedAccessException + FullyQualifiedErrorId : ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.TestPathCommand
I've tried setting the Application Pool in IIS to run as NETWORK SERVICE
and added the DOMAIN\SERVERNAME$
to an AD group that has admin rights over the remote servers. I've even granted that server rights to the specific file paths.
I've tried setting the Applicaiton Pool to run as a network account that we've built in AD that is in the same AD group that provides admin rights.
If I run the PS1 script to just pass back the information that PHP sends it it works fine so I know the script is being accessed, it just can't access the remote servers.
I'm open to ideas if there is a better way to do this.
Thanks for the help!