Very well done, these are my notes:
The performance of page in general got a great push.
The Error is not appearing any more , still we need to test for some time.
The Loading from SQL is super fast now i don’t know why.
The Enable-UDLogging -FilePath still not working.
i’d like to thank you so much @adam for your efforts ,really appreciate your help.
Dear Adam,
After testing for some time suddenly the buttons stopped working and gives the below issue on click
additionally the Collection was modified; enumeration operation may not execute. error came up again
adam
September 30, 2019, 9:29pm
24
Ok. Thanks for the info. For the first problem, I think I see an issue that I am working on. Still researching the second problem.
1 Like
adam
September 30, 2019, 11:11pm
25
I think I’ve fixed issue 1. Tonight’s nightly release will include that change. still looking at issue 2.
1 Like
Tested the new nightly release with no luck in both issues
adam
October 1, 2019, 8:25pm
27
Bummer. I’ve spent today working on some issues I found with sessions that should be in tonight’s nightly release but I’m not 100% sure that they will solve your issues. I’m worried I’m missing something that you are seeing that I am not testing for.
i just notice some thing, i have two modes for server monitoring
if it’s a workgroup i am using the ip as a computer name else i use the computer name it self
i discovered now that with workgroup servers buttons are working but the domain is not which is misleading as the same code is working in ise and normal powershell
the only deference is that i am using session variable to pass the name and ip between pages but in ise i define it explicitly
example Working code :
#Windows UPTime
New-UdColumn -Size 1.5 -Endpoint {
New-UDCard -Title "Windows UPTime" -TextSize Medium -Endpoint {
$Lastreboottime = Get-WmiObject -ComputerName $Session:CurrentServerIP Win32_OperatingSystem | select @{ LABEL = 'LastBootUpTime'; EXPRESSION = { $_.ConverttoDateTime($_.lastbootuptime) } }
$Uptime = (get-date) - ($Lastreboottime).LastBootUpTime
$UptimeTitle = "$([math]::Round($($Uptime.TotalHours), 2)) Hours"
New-UDButton -Text $UptimeTitle -Icon clock -IconAlignment left -OnClick {
Show-UDModal -Content {
New-UdGrid -Title "UpTime History" -NoPaging -NoFilter -NoExport -Headers @("Startup", "Shutdown", "Uptime /Days", "Uptime /HRs") -Properties @("UStartup", "UShutdown", "UptimeDays", "UptimeHRs") -Endpoint {
$Uptimes = @()
$filterHt = @{
'LogName' = 'System'
'ID' = 6005
}
$StartEvents = Get-WinEvent -ComputerName $Session:CurrentServerIP -FilterHashtable $filterHt
$StartTimes = $StartEvents.TimeCreated
## Find all stop events
$filterHt.ID = 6006
$StopEvents = Get-WinEvent -ComputerName $Session:CurrentServerIP -FilterHashtable $filterHt -Oldest
$StopTimes = $StopEvents.TimeCreated
foreach ($startTime in $StartTimes)
{
$StopTime = $StopTimes | ? { $_ -gt $StartTime } | select -First 1
if (-not $StopTime)
{
$StopTime = Get-Date
}
$output = [ordered]@{
'UStartup' = $StartTime
'UShutdown' = $StopTime
'UptimeDays' = [math]::Round((New-TimeSpan -Start $StartTime -End $StopTime).TotalDays, 2)
'UptimeHRs' = [math]::Round((New-TimeSpan -Start $StartTime -End $StopTime).TotalHours, 2)
}
$Uptimes += [pscustomobject]$output
}
$UpTimes | Out-UDGridData
}
}
}
}
}
Example not working code:
#Windows UPTime
New-UdColumn -Size 1.5 -Endpoint {
New-UDCard -Title "Windows UPTime" -TextSize Medium -Endpoint {
$Lastreboottime = Get-WmiObject -ComputerName $Session:CurrentServerName Win32_OperatingSystem | select @{ LABEL = 'LastBootUpTime'; EXPRESSION = { $_.ConverttoDateTime($_.lastbootuptime) } }
$Uptime = (get-date) - ($Lastreboottime).LastBootUpTime
$UptimeTitle = "$([math]::Round($($Uptime.TotalHours), 2)) Hours"
New-UDButton -Text $UptimeTitle -Icon clock -IconAlignment left -OnClick {
Show-UDModal -Content {
$Uptimes = @()
$filterHt = @{
'LogName' = 'System'
'ID' = 6005
}
$StartEvents = Get-WinEvent -ComputerName $Session:CurrentServerName -FilterHashtable $filterHt
$StartTimes = $StartEvents.TimeCreated
## Find all stop events
$filterHt.ID = 6006
$StopEvents = Get-WinEvent -ComputerName $Session:CurrentServerName -FilterHashtable $filterHt -Oldest
$StopTimes = $StopEvents.TimeCreated
foreach ($startTime in $StartTimes)
{
$StopTime = $StopTimes | ? { $_ -gt $StartTime } | select -First 1
if (-not $StopTime)
{
$StopTime = Get-Date
}
$output = [ordered]@{
'UStartup' = $StartTime
'UShutdown' = $StopTime
'UptimeDays' = [math]::Round((New-TimeSpan -Start $StartTime -End $StopTime).TotalDays, 2)
'UptimeHRs' = [math]::Round((New-TimeSpan -Start $StartTime -End $StopTime).TotalHours, 2)
}
$Uptimes += [pscustomobject]$output
}
$UpTimes | Out-UDGridData
}
}
}
}
just to mention , This issue was not in the previous release.
here is what i get on button click of the uptime
For the record The Buttons issue was a code issue not UD issue, still the session issues not solved.