43 lines
2.3 KiB
PowerShell
43 lines
2.3 KiB
PowerShell
New-UDApp -Title 'Infra-VMware_Snapshot_NPD' -Content {
|
|
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-ITDVMwareSnapshotRequest.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],[PSUJobIdSchedule],[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'
|
|
New-UDTableColumn -Property 'DateTime' -Title 'DateTime'
|
|
New-UDTableColumn -Property 'RequestedBy' -Title 'RequestedBy'
|
|
New-UDTableColumn -Property 'DurationHours' -Title 'DurationHours'
|
|
New-UDTableColumn -Property 'Status' -Title 'Status'
|
|
New-UDTableColumn -Property 'NotifyEmail' -Title 'NotifyEmail'
|
|
New-UDTableColumn -Property 'PSUJobIdRequest' -Title 'PSUJobIDRequest'
|
|
New-UDTableColumn -Property 'PSUJobIdSchedule' -Title 'PSUJobIDSchedule'
|
|
New-UDTableColumn -Property 'PSUJobIdDelete' -Title 'PSUJobIDDelete'
|
|
New-UDTableColumn -Property 'TakenDateTime' -Title 'TakenDateTime'
|
|
New-UDTableColumn -Property 'ExpireDateTime' -Title 'ExpireDateTime'
|
|
) -Data ($SqlRecords | Sort-Object -Descending Id) -ShowPagination -PageSize 20 -Dense
|
|
} |