Running a Dashboard in IIS with Pwsh.exe instead of Windows Powershell?

Who knows what I’ll find – but hopefully I don’t have to do too much, if any manipulation in appsettings, etc…! I do like to dig around! I’ll be sure to publish/post anything that can be generalized enough to submit publicly (which we try to do with as much as we can).

Cool. You’re the man! Thanks for giving back!

1 Like

I suggested this to another user and he was able to do the same with Windows PowerShell. He has UD installed on the $PSModulePath of his IIS AppPool user. The result is that he doesn’t have to copy the entire UD module into his website path. If he wants to upgrade UD, he just upgrades it in one place.

It’s just a web.config file and the dashboard.ps1.


<aspNetCore processPath="C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" arguments=".\ud-configp72hpilo.ps1" stdoutLogEnabled="true" stdoutLogFile="[\\?\%home%\LogFiles\stdout](file://%3f/%25home%25/LogFiles/stdout)" forwardWindowsAuthToken="true" />

This is looking like the way forward for IIS hosting.


Best thread ever! :slight_smile:
I will see how Powershell v7 RC2 run the dashboard!
the quick test I did, show that all is working well.

Hey ! I did the exact same as you on web.config and nothing starts at all when I try to start the dashboard from IIS.

If I start it from a powershell command prompt everything looks ok, no error / warning or anything.

I took a look at the logs, but nothing relevant shows up.

Any idea where I could look ?

Working on a Windows 2019 box
.NET Core 3.1.1

Thanks in advance !

You need to make sure that the modul are installed, and possible import it manually

well UD module 2.8.2 is installed and importing that module is the first thing my dashboard.ps1 script is doing. :frowning:

Are you sure it successfully load it? Try full path to it.

full path it is, when I start the very same dashboard.ps1 everything goes fine, but not when trying to run it from IIS. Still looking around though.

This could be an issue with the $PSModulePath. Where are you installing the module? The AppPool user might not have the same $PSModulePath as your current user.

And the app pool the correct permissions?

Interestingly my ‘woes’ have also returned. Troubleshooting now (and doing a little research into hosting with ASP.NET core to see if I can figure out whats going on). If you want to connect offline at any point @adam I can be available a bit this weekend, just shoot me a message.

Okay, I got mine working again. My web config looks like this:

<?xml version="1.0" encoding="utf-8"?>
    Configure your application settings in appsettings.json. Learn more at
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
	<aspNetCore processPath="C:\Program Files\PowerShell\7-preview\pwsh.exe" arguments="-noprofile -noninteractive -Command . D:\InetPub\MyDashboard\Dashboard.ps1" stdoutLogEnabled="true" stdoutLogFile="C:\TEMP\MyDashboard\LogName" forwardWindowsAuthToken="true" />
        <remove name="X-Powered-By" />
        <compilation defaultLanguage="vb" />

I know I fiddled with some of the other settings in IIS – so I’ll try to grab some screenshots and compare with a test (default settings) site too. It seems though that the issue may be the need for the -noninteractive and -noprofile calls. But I could be wrong.

Is everyone else still having issues? I have found that more often than not when it does not work, its due to an issue with the code. You really want to write good logging into your code.

I use this nifty little filter (similar to a function) to get better verbose output as well (I’m sure there is a better way of doing it)

filter Write-VerboseT {
		[Parameter(Mandatory, ValueFromPipeline, Position = 0)]
	Write-Verbose -Message $("[$(Get-Date -Format G)]: $Message")