ironmansoftware / universal-automation

Universal Automation is the PowerShell-first automation platform.
https://ironmansoftware.com/universal-automation/
MIT License
24 stars 4 forks source link

Unexpected Write into C:\Microsoft\Windows\PowerShell\StartupProfileData-NonInteractive #143

Closed claudiospizzi closed 4 years ago

claudiospizzi commented 4 years ago

Describe the Issue

I'm not sure why, but Universal Automation hosted in IIS tries to write into the C:\ root to write some startup profile data. In my case, the IIS user doesn't have the permissions to write into that folder:

To Reproduce

Hosted in IIS:

$uaServerSplat = @{
    ConnectionString    = 'C:\PathToDatabase.db'
    RepositoryPath      = 'C:\PathToRepo'
    GitRemote           = 'https://repourl'
    GitRemoteCredential = $cred
    InProcess           = $true
}
Start-UAServer @uaServerSplat

Expected behavior

Not sure where this comes from. Would be great if this is redirected either to the users app data or the global C:\ProgramData.

Screenshots

image

Version Information

adamdriscoll commented 4 years ago

Looks like this is a part of PowerShell itself. Seems to me it's a profile cache. I'm not sure if starting it with -NoProfile will work around this behavior.

adamdriscoll commented 4 years ago

This worked for me.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!--
    Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
  -->
  <system.webServer>
    <security>
      <!-- <requestFiltering removeServerHeader ="true" /> -->
    </security>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="powershell.exe" arguments="-NoProfile -File .\dashboard.ps1" stdoutLogEnabled="true" stdoutLogFile="C:\Users\iis\AppData\Local\Logs\log.txt" forwardWindowsAuthToken="true" />
    <httpProtocol>
      <customHeaders>
        <remove name="X-Powered-By" />
      </customHeaders>
    </httpProtocol>  
  </system.webServer>
</configuration>