New-UDPage -Url "/PRD" -Name "PRD" -Content { New-UDTypography -Text 'PRD' <#New-UDForm -Content { New-UDRow -Columns { New-UDColumn -SmallSize 6 -LargeSize 6 -Content { New-UDTextBox -Label "VMName" -Id VMName New-UDTextBox -Label "DateTime" -Id DateTime New-UDTextBox -Label "DurationHours" -Id DurationHours New-UDTextBox -Label "Email" -Id Email } } } -OnSubmit { $InvokePSUScriptParams = @{ Script = 'New-ITDVMwareSnapshotTask.ps1' VMName = $EventData.VMName; DateTime = $EventData.DateTime; DurationHours = $EventData.DurationHours; Email = $EventData.Email } $InvokePSUScriuptResult = Invoke-PSUScript @InvokePSUScriptParams -Wait Show-UDToast -Message ("attempting snapshot") } #> switch($env:COMPUTERNAME){ "ITDWINAUTOT1" { $ServerInstance = "itdintsql22p1.nd.gov\INTSQL22P1" $Database = "ITD-Systems-Automation" $SnapshotTable = "Infra_VMware_VirtualMachine_VMSnapshots_NPD" } "ITDWINAUTOP1" { $ServerInstance = "itdintsql22p1.nd.gov\INTSQL22P1" $Database = "ITD-Systems-Automation" $SnapshotTable = "Infra_VMware_VirtualMachine_VMSnapshots_PRD" } } $SqlQuery = "SELECT [ID],[VMName],[DateTime],[RequestedBy],[DurationHours],[Status],[NotifyEmail],[PSUJobIdRequest],[PSUJobIdDelete],[TakenDateTime],[ExpireDateTime],[DeleteDateTime] FROM [$Database].[dbo].[$SnapshotTable]" $SqlRecords = Invoke-Sqlcmd -ServerInstance $ServerInstance -Database $Database -Query $SqlQuery -Credential $Secret:sql_itdpsu1 -Verbose New-UDTable -Columns @( New-UDTableColumn -Property 'Id' -Title 'Id' -ShowFilter New-UDTableColumn -Property 'VMName' -Title 'VMName' -ShowFilter New-UDTableColumn -Property 'DateTime' -Title 'DateTime' New-UDTableColumn -Property 'RequestedBy' -Title 'RequestedBy' -ShowFilter New-UDTableColumn -Property 'DurationHours' -Title 'DurationHours' New-UDTableColumn -Property 'Status' -Title 'Status' -ShowFilter New-UDTableColumn -Property 'NotifyEmail' -Title 'NotifyEmail' -ShowFilter New-UDTableColumn -Property 'PSUJobIdRequest' -Title 'PSUJobIDRequest' -ShowFilter New-UDTableColumn -Property 'PSUJobIdDelete' -Title 'PSUJobIDDelete' -ShowFilter New-UDTableColumn -Property 'TakenDateTime' -Title 'TakenDateTime' New-UDTableColumn -Property 'ExpireDateTime' -Title 'ExpireDateTime' ) -Data ($SqlRecords | Sort-Object -Descending Id) -ShowPagination -PageSize 20 -Dense } -Title "PRD" -Icon @{ id = 'd0f3391d-efa6-4210-b4dd-ef0cad028382' type = 'icon' }