update
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
$Navigation = @(
|
||||
New-UDListItem -Label 'Home' -OnClick {
|
||||
Invoke-UDRedirect -Url '/Home'
|
||||
}
|
||||
switch($env:computername){
|
||||
"ITDWINAUTOT1" {
|
||||
New-UDListItem -Label 'Infra-VMware.Snapshot_NPD' -OnClick {
|
||||
Invoke-UDRedirect -Url '/NPD'
|
||||
}
|
||||
}
|
||||
"ITDWINAUTOP1" {
|
||||
New-UDListItem -Label 'Infra-VMware.Snapshot_PRD' -OnClick {
|
||||
Invoke-UDRedirect -Url '/PRD'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
New-UDListItem -Label 'Live Snapshots' -OnClick {
|
||||
Invoke-UDRedirect -Url '/LiveSnapshots'
|
||||
}
|
||||
)
|
||||
|
||||
New-UDApp -Title 'PowerShell Universal' -Pages @(
|
||||
Get-UDPage -Name 'Home'
|
||||
switch($env:computername){
|
||||
"ITDWINAUTOT1" { Get-UDPage -Name 'NPD' }
|
||||
"ITDWINAUTOP1" { Get-UDPage -Name 'PRD' }
|
||||
}
|
||||
Get-UDPage -Name 'LiveSnapshots'
|
||||
) -Navigation $Navigation
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
New-UDPage -Url "/LiveSnapshots" -Name "LiveSnapshots" -Content {
|
||||
New-UDForm -Content {
|
||||
New-UDRow -Columns {
|
||||
New-UDColumn -SmallSize 6 -LargeSize 6 -Content {
|
||||
|
||||
}
|
||||
}
|
||||
} -OnSubmit {
|
||||
Connect-ITDvCenter -Credential $Secret:svcitdvmsnapmgr
|
||||
Show-UDToast -Message ("attempting query") -
|
||||
$AllSnapshots = Get-Datacenter | Where-Object Name -notlike "Normandy*" | Get-VM | Get-Snapshot | Select-Object VM,Name,SizeGB,Created,Description
|
||||
Disconnect-ITDvCenter
|
||||
|
||||
New-UDTable -Columns @(
|
||||
New-UDTableColumn -Property "VM" -Title "VM" -ShowFilter
|
||||
New-UDTableColumn -Property 'Name' -Title 'Name' -ShowFilter
|
||||
New-UDTableColumn -Property "SizeGB" -Title "SizeGB"
|
||||
New-UDTableColumn -Property "Created" -Title "Created"
|
||||
New-UDTableColumn -Property "Description" -Title "Description"
|
||||
|
||||
) -Data ($AllSnapshots) -ShowPagination -PageSize 20 -Dense
|
||||
}
|
||||
} -Title "LiveSnapshots" -Icon @{
|
||||
type = 'icon'
|
||||
id = '74a7d396-2f35-4e10-a5c1-918f59bea61d'
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
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'
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
New-UDPage -Url "/PRD" -Name "PRD" -Content {
|
||||
New-UDTypography -Text 'PRD'
|
||||
} -Icon @{
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Home' -Content {
|
||||
New-UDTypography -Text 'Home'
|
||||
}
|
||||
Reference in New Issue
Block a user