$user variable empty with Windows Auth and IIS

I have a working Windows Auth with IIS environment. When I go to /login the right user is recognized and logged in. As far as I understood there should be a variable named $user which is holding the username of currently logged in user but I am not able to get any information out of that variable since it appears to be empty.

I read several related topics without success.

Any hints?

Product: PowerShell Universal
Version: 1.3.1

yes, that is correct. You can access the variable in your dashboard with $User.

just make a new ud page and display the variable

$Pages += New-UDPage -Name "example" -Endpoint {
    New-UDRow {
        New-UDButton -Text "+" -OnClick (New-UDEndpoint -Endpoint {
                Show-UDModal -Header {
                    New-UDHeading -Size 3 -Text "Info"
                } -Content {
                    New-UDRow -Endpoint {
                        New-UDColumn -Size 4 {
                            New-UDTextbox -Value $(Get-Date) -Disabled -Label "date"
                        }
                        New-UDColumn -Size 4 {
                            New-UDTextbox -Value $User -Disabled -Label "user"
                        }
                    } # info row
                }
            })
    }
}
1 Like

Thank you @this-is-mihai
I changed from -Content to -Endpoint and now I can access needed information.

You’re welcome. Actually, that is why you should write the Universal Dashboard version also at the beginning of the comment.
Universal Automation can run Universal Dashboard v2 and also v3. The dashboard has some differences between them. In our case, the code i wrote is for Universal Dashboard v2. So you maybe running the Universal Automation 1.3.1, but you are running v2 Universal Dashboard. Anyway, glad you resolved your problem. If you have any more questions, just ask around here. I’ve also had a lot of questions as i started developing with UA and UD and was to timid to ask on the forum which led to a longer time of development. So any thing you can’t solve or don’t understand, just shoot a question here!

1 Like