Out-File in Dashboard Monitor


I setup a simple monitoring tool that looks at APIs using UD. It uses UDRow, UDLayout, & UDCard.
I wanted to go one step further, and log the ‘down’ items to a file. I tried to do Out-File after the step where I check if something is up or down (to determine the UDCard color), but it does not see to write to the file.

                Else {
                $color = "Red"
                $status = "Stopped"
                $fColor = "White"
                "$(Get-Date -format MM/dd/yyyy),$(Get-Date -format HH:mm:ss),$name,API Stopped,0,0" | Out-File "D:\Scripts\Monitor\systemAlerts.csv" -Append

                New-UDCard -Title "$name" -Text "System is $status" -BackgroundColor "$color" -FontColor $fColor

I appreciate any help, as I am really new to UD, but love using it!
I might not be putting the out-file in the right section of the script.

Thank you!

Hi, Welcome to the forums!
I’d ask first, how are you running UD, what version and is it as a service, or IIS?
Either way, you’ll need to ensure that either the service account or the app pool identity has write access to d:\scripts\monitor
Second, stick a -force flag on there, maybe even -confirm:$false, see if that makes any difference.
Third, check to see if any errors are going into your $error variable, otherwise check out the logs.
Enable-UDLogging -FilePath “pathtolog.log” can be used for this.

1 Like

Thank you for your help insomniacc!
I had to restart the service for this particular change, but I also added -force on there and it started working. :slight_smile: