I have created this dashboard that uses updateservices module and retrieves data from another server, the WSUS server, which is on the same network as the one that i am running IIS from.
The script and dashboard work perfectly when runned from Powershell ISE ( with and without admin) but fails in IIS with the errors :
Exception calling “GetUpdateServer” with “2” argument(s): “The request failed with HTTP status 401: Unauthorized.”
and this on the second tab
Exception calling “GetUpdateServer” with “2” argument(s): “The request failed with HTTP status 401: Unauthorized.”
I should mention the script uses 2 txt files to store values and count\retrieve the values back and display them on the dashboard.
I have checked the logs and it looks like i am logged in with my username, the one that i use to get onto the server.
Also, i made the file accessible to be modified.
Here is my web.config, if needed:
<?xml version="1.0" encoding="utf-8"?>
I am using .NET v4.5 Integrated with LocalService and Load User Profile is = True in advanced.
I runned out of things to try, some help would me much appreciated
Thank you for the suggestion. I added my account credentials to the DefaultAppPool user, as suggested and the files look like are retrieving the right values.
Now i get the 502.5-Process Failure screen after the dashboard is in loading state for about 2 minutes.
I need to mention that from the document given, i skipped one step as i didnt exactly understand if is necessarry and where i should put it...its this section:
The web.config file should start PowerShell.exe or Pwsh.exe. As an argument to the process, you’ll want to include the dashboard script. Edit the aspNetCore node in the web.config file to include this information.
</system.webServer>
<system.web>
trust level=“Full”/>
identity impersonate=“true” username=“myname” password=“mypass”/>
</system.web>
(removed the < from trust level and identity because the text dissapears here for some reson)
Do you think this might be the cause to why i am getting this error?
Hey @daudjawad sorry about the late reply, was a busy one at work today…ok well I am no IIS guru, and I might have my IIS setup different to other users on here but it works for my environment…I am happy to detail how I go about setting up a site…maybe worth searching the forum…if you haven’t already…as I got a feeling this is similar IIS app pool ID and IIS service account problem? as same error…anyways to help further post your script and sure either myself or someone else can assist further. Peace
P.S I never has to touch my webconfig file
Took me a bit, but I have IIS working really well right now.
Here are some screenshots of my setup that might help you out. Keep in mind, that I actually switched from Windows Authentication to using ADFS for authentication.
In my website:
I have authentication set to Anonymous, with Basic and Windows disabled.
The website is bound to 443 ONLY, with a SAN certificate.
here are my app pool settings:
(Note: don’t kill me, but I use a domain admin account to run the app pool. It’s just easier for me. Some of my commands don’t take authentication, so I can’t switch.)
I was restarting the app pool nightly, but I’m currently experimenting with not restarting it. I’m curious to see how well it does over a month. I only have about 20 people accessing the dashboard at the moment.
Hi eefisherv,
I have a few questions that might help me understand some stuff from what you said.
So i have setup my authentication to Anonymous and use a custom domain admin account too because i need to retrieve some data from another server.
Why is your website bound to port 443 and is it necessary to have a SAN cert?
Also, i realised that in web.config i have forgot to add .\dashboard.ps1.
Sorry for the questions and description but i have never worked with IIS so i don`t have an idea on how to use it, thought it might be straightforward.
Right now i am getting this lines in the log file:
2020-02-27 15:39:43 ::1 GET / - 400 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/80.0.3987.87+Safari/537.36 - 502 5 2147500037 507 2020-02-27 15:39:43 ::1 GET /favicon.ico - 400 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/80.0.3987.87+Safari/537.36 http://localhost:400/ 502 5 2147500037 509
Also, i need to mention that i used my account in the identity section of the DefaultAppPool and Anonymous authentication section.
Our InfoSec team requires everything to be SSL. Using SSL, well thats completely up to you. I use SAN certificates so I can use different DNS names. The cert comes from our internal corporate CA, so doesn’t cost me anything.
For UD on IIS, the requests are technically proxied to the backend Kestral process. Thats why you see the “localhost:400”. In the background, its just like you’re running it on your desktop.
I assume you’re remembering the “-Wait” in your Start-UDDashboard command.
Ah i see.
Ok, now i get it, i was actually thinking how IIS works in the backend.
Yes, i have added the Wait in my Start-UDDashboard and removed the port number, let IIS set that.
Also, i don`t know if is relevant but i have multiple pages on this dashboard, not sure if any extra setup is needed for that.
Glad to hear you got it sorted @daudjawad feel I should have sent you this link:- https://github.com/psDevUK/psUniversalDashboard this is a working dashboard I used on IIS I uploaded to github. A few people have told me it helped them out, hopefully it will do the same for you. It’s SQL driven, so I had to edit quite a bit of it, but I have multiple pages in their own .ps1 file to make troubleshooting easier, the main root file is the dashboard.ps1 file hope this helps