Files
Zack Meier 1d304511b8 update
2026-04-15 15:45:50 -05:00

46 lines
2.4 KiB
PowerShell

New-UDPage -Url "/NPD" -Name "NPD" -Content {
New-UDTypography -Text 'NPD'
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")
}
$ServerInstance = "itdintsql22p1.nd.gov\INTSQL22P1"
$Database = "ITD-Systems-Automation"
$SqlQuery = "SELECT [ID],[VMName],[DateTime],[RequestedBy],[DurationHours],[Status],[NotifyEmail],[PSUJobIdRequest],[PSUJobIdDelete],[TakenDateTime],[ExpireDateTime],[DeleteDateTime] FROM [ITD-Systems-Automation].[dbo].[Infra_VMware_VirtualMachine_VMSnapshots_NPD]"
$SqlRecords = Invoke-Sqlcmd -ServerInstance $ServerInstance -Database $Database -Query $SqlQuery -Credential $Secret: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
} -Icon @{
type = 'icon'
id = '3e16c7ba-54bd-4edb-b4f3-0e644f6bd656'
}