update
This commit is contained in:
+3
@@ -0,0 +1,3 @@
|
||||
New-UDApp -Title 'PowerShell Universal' -Pages @(
|
||||
Get-UDPage -Name 'home'
|
||||
)
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
New-UDPage -Url "/Home" -Name "Home" -Content {
|
||||
New-UDTypography -text 'Home' -id 'homeText'
|
||||
New-UDTextbox -id 'VMName'
|
||||
} -Generated -Layout (
|
||||
New-UDPageLayout -Large @(
|
||||
) -Medium @(
|
||||
New-UDItemLayout -Id 'homeText' -Row 0 -Column 0 -RowSpan 1 -ColumnSpan 1
|
||||
New-UDItemLayout -Id 'VMName' -Row 0 -Column 1 -RowSpan 1 -ColumnSpan 1
|
||||
) -Small @(
|
||||
) -ExtraSmall @(
|
||||
) -ExtraExtraSmall @(
|
||||
)
|
||||
)
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
New-UDApp -Title 'DashboardTest' -Pages @(
|
||||
New-UDPage -Name "test2" -Content {
|
||||
New-UDForm -Content {
|
||||
New-UDTextbox -Label 'VMName' -Id 'VMName'
|
||||
New-UDTextbox -Label 'HoursToKeep' -Id 'HoursToKeep'
|
||||
New-UDDatePicker -Label 'StartDate' -Id "StartDate"
|
||||
New-UDTimePicker -Label 'StartTime' -Id "StartTime"
|
||||
|
||||
} -OnSubmit {
|
||||
#Show-UDToast -Message $EventData.txtTextField
|
||||
#Show-UDToast -Message $EventData.chkCheckbox
|
||||
#Invoke-PSUScript -Script 'Test-FormSubmission.ps1' -VMName $EventData.VMName
|
||||
#"Current User = $User, StartDate = " + $EventData.StartDate + " " + $EventData.StartTime
|
||||
|
||||
|
||||
|
||||
$StartDateTime = $EventData.StartDate.Date
|
||||
$StartDateTime = $StartDateTime.AddHours($EventData.StartTime.Hour)
|
||||
$StartDateTime = $StartDateTime.AddMinutes($EventData.StartTime.Minute)
|
||||
Show-UDToast -Message ("Start Date/Time is: " + $StartDateTime) -Duration 20000
|
||||
}
|
||||
}
|
||||
)
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Home' -Content {
|
||||
New-UDTypography -Text 'Home' -Id 'homeText'
|
||||
} -Generated
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
New-UDPage -Url "/test" -Name "test" -Content {
|
||||
|
||||
} -Generated -Layout (
|
||||
New-UDPageLayout -Large @(
|
||||
) -Medium @(
|
||||
) -Small @(
|
||||
) -ExtraSmall @(
|
||||
) -ExtraExtraSmall @(
|
||||
)
|
||||
)
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
$Navigation = @(
|
||||
New-UDListItem -Label 'Home' -OnClick {
|
||||
Invoke-UDRedirect -Url '/Home'
|
||||
}
|
||||
switch($env:computername){
|
||||
"ITDWINAUTOT1" {
|
||||
New-UDListItem -Label 'Remove-ITDExpiredFiles Log' -OnClick {
|
||||
Invoke-UDRedirect -Url '/NPD'
|
||||
}
|
||||
}
|
||||
"ITDWINAUTOP1" {
|
||||
New-UDListItem -Label 'Remove-ITDExpiredFiles Log' -OnClick {
|
||||
Invoke-UDRedirect -Url '/PRD'
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
New-UDApp -Title 'PowerShell Universal' -Pages @(
|
||||
Get-UDPage -Name 'Home'
|
||||
switch($env:computername){
|
||||
"ITDWINAUTOT1" { Get-UDPage -Name 'NPD' }
|
||||
"ITDWINAUTOP1" { Get-UDPage -Name 'PRD' }
|
||||
}
|
||||
) -Navigation $Navigation
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
New-UDPage -Url "/PRD" -Name "PRD" -Content {
|
||||
New-UDTypography -Text 'Remove Expired Files Log'
|
||||
|
||||
switch($env:COMPUTERNAME){
|
||||
"ITDWINAUTOT1" {
|
||||
$ServerInstance = "itdintsql22p1.nd.gov\INTSQL22P1"
|
||||
$Database = "ITD-Systems-Automation"
|
||||
$Table = "Infra_WindowsServer_FileManagement_RemoveITDExpiredFiles_NPD"
|
||||
}
|
||||
"ITDWINAUTOP1" {
|
||||
$ServerInstance = "itdintsql22p1.nd.gov\INTSQL22P1"
|
||||
$Database = "ITD-Systems-Automation"
|
||||
$Table = "Infra_WindowsServer_FileManagement_RemoveITDExpiredFiles_PRD"
|
||||
}
|
||||
}
|
||||
|
||||
$SqlQuery = "SELECT [PSUJobId],[DateTime],[ComputerName],[Status],[FullName] FROM [$Database].[dbo].[$Table]"
|
||||
$SqlRecords = Invoke-Sqlcmd -ServerInstance $ServerInstance -Database $Database -Query $SqlQuery -Credential $Secret:sql_itdpsu1 -Verbose
|
||||
|
||||
New-UDTable -Columns @(
|
||||
New-UDTableColumn -Property 'PSUJobId' -Title 'PSUJobId' -ShowFilter
|
||||
New-UDTableColumn -Property 'DateTime' -Title 'DateTime' -ShowFilter
|
||||
New-UDTableColumn -Property 'ComputerName' -Title 'ComputerName' -ShowFilter
|
||||
New-UDTableColumn -Property 'Status' -Title 'Status' -ShowFilter
|
||||
New-UDTableColumn -Property 'FullName' -Title 'FullName' -ShowFilter
|
||||
) -Data ($SqlRecords | Sort-Object -Descending Id) -ShowPagination -PageSize 20 -Dense
|
||||
} -Title "PRD" -Icon @{
|
||||
id = 'd0f3391d-efa6-4210-b4dd-ef0cad028382'
|
||||
type = 'icon'
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Home' -Content {
|
||||
New-UDTypography -Text 'Home' -Id 'homeText'
|
||||
} -Generated
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
$Navigation = @(
|
||||
New-UDListItem -Label 'Home' -OnClick {
|
||||
Invoke-UDRedirect -Url '/Home'
|
||||
}
|
||||
New-UDListItem -Label 'Infra-ActiveDirectory.Object_NPD' -OnClick {
|
||||
Invoke-UDRedirect -Url '/NPD'
|
||||
}
|
||||
New-UDListItem -Label 'Infra-ActiveDirectory.Object__PRD' -OnClick {
|
||||
Invoke-UDRedirect -Url '/PRD'
|
||||
}
|
||||
)
|
||||
|
||||
New-UDApp -Title 'PowerShell Universal' -Pages @(
|
||||
Get-UDPage -Name 'Home'
|
||||
Get-UDPage -Name 'NPD'
|
||||
Get-UDPage -Name 'PRD'
|
||||
) -Navigation $Navigation
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
New-UDPage -Url "/NPD" -Name "Infra-ActiveDirectory.Object_NPD" -Content {
|
||||
New-UDTypography -Text 'NPD'
|
||||
} -Icon @{
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Groups' -Content {
|
||||
New-UDTypography -Text 'Groups'
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Users' -Content {
|
||||
New-UDTypography -Text 'Users'
|
||||
}
|
||||
+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'
|
||||
}
|
||||
+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
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
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'
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Home' -Content {
|
||||
New-UDTypography -Text 'Home' -Id 'homeText'
|
||||
} -Generated
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
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
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
New-UDPage -Name "SnapshotReview" -Content {
|
||||
|
||||
} -Title "SnapshotReview" -Icon @{
|
||||
} -Generated
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
$Navigation = @(
|
||||
New-UDListItem -Label 'Home' -OnClick {
|
||||
Invoke-UDRedirect -Url '/Home'
|
||||
}
|
||||
New-UDListItem -Label 'AD Service Accounts' -OnClick {
|
||||
Invoke-UDRedirect -Url '/ADServiceAccount'
|
||||
}
|
||||
)
|
||||
|
||||
New-UDApp -Title 'PowerShell Universal' -Pages @(
|
||||
Get-UDPage -Name 'Home'
|
||||
Get-UDPage -Name 'ADServiceAccount'
|
||||
) -Navigation $Navigation
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
New-UDPage -Url "/ADServiceAccount" -Name "ADServiceAccount" -Content {
|
||||
New-UDTypography -Text 'ADServiceAccount'
|
||||
$ServerInstance = "itdintsql22p1.nd.gov\INTSQL22P1"
|
||||
$Database = "ITD-Systems-Automation"
|
||||
$SqlQuery = "SELECT TOP (1000) [RequestedBy]
|
||||
,[PSUJobId]
|
||||
,[SamAccountName]
|
||||
,[Description]
|
||||
,[PasswordstateTitle]
|
||||
,[PasswordstateList]
|
||||
,[SnowCHGNum]
|
||||
,[Status]
|
||||
,[DomainName]
|
||||
,[DateTime]
|
||||
FROM [ITD-Systems-Automation].[dbo].[Infra_ActiveDirectory_Object_NewITDADServiceAccount_PRD]
|
||||
ORDER BY [DateTime] DESC"
|
||||
$SqlRecords = Invoke-Sqlcmd -ServerInstance $ServerInstance -Database $Database -Query $SqlQuery -Credential $Secret:sql_itdpsu1 -Verbose
|
||||
|
||||
New-UDTable -Columns @(
|
||||
New-UDTableColumn -Property 'PSUJobId' -Title 'PSUJobId' -ShowFilter
|
||||
New-UDTableColumn -Property 'DateTime' -Title 'DateTime' -ShowFilter
|
||||
New-UDTableColumn -Property 'RequestedBy' -Title 'PSUJobId' -ShowFilter
|
||||
New-UDTableColumn -Property 'SamAccountName' -Title 'SamAccountName' -ShowFilter
|
||||
New-UDTableColumn -Property 'PasswordstateList' -Title 'PasswordstateList' -ShowFilter
|
||||
New-UDTableColumn -Property 'PasswordstateTitle' -Title 'PasswordstateTitle' -ShowFilter
|
||||
New-UDTableColumn -Property 'SnowCHGNum' -Title 'SnowCHGNum' -ShowFilter
|
||||
New-UDTableColumn -Property 'Status' -Title 'Status' -ShowFilter
|
||||
New-UDTableColumn -Property 'Domainname' -Title 'DomainName' -ShowFilter
|
||||
|
||||
) -Data ($SqlRecords | Sort-Object -Descending Id) -ShowPagination -PageSize 20 -Dense
|
||||
} -Icon @{
|
||||
type = 'icon'
|
||||
id = '259b4c05-17df-4440-9907-57ab4df1e6c9'
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Home' -Content {
|
||||
New-UDTypography -Text 'Home' -Id 'homeText'
|
||||
} -Generated
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
New-UDApp -Title 'SyncVMwareVMtoSharePoint' -Pages @(
|
||||
New-UDPage -Name "Home" -Content {
|
||||
New-UDForm -Content {
|
||||
New-UDTypography -Text 'Enter the information below (all fields required) and click the Submit button'
|
||||
New-UDRow -Columns {
|
||||
New-UDColumn -SmallSize 6 -LargeSize 6 -Content {
|
||||
New-UDTextbox -Label 'RequestedForEmail' -Id RequestedForEmail
|
||||
New-UDTextbox -Label 'ADDomain' -Id ADDomain
|
||||
New-UDTextbox -Label 'SamAccountName' -Id SamAccountName
|
||||
New-UDTextbox -Label 'Description' -Id Description
|
||||
New-UDTextbox -Label 'PasswordstateList' -Id PasswordstateList
|
||||
New-UDTextbox -Label 'PasswordstateTitle' -Id PasswordstateTitle
|
||||
}
|
||||
}
|
||||
} -OnValidate {
|
||||
$FormContent = $EventData
|
||||
|
||||
if ($EventData.RequestedForEmail -eq $null -or $EventData.RequestedForEmail -eq '' -or $EventData.ADDomain -eq $null -or $EventData.ADDomain -eq '' -or $EventData.SamAccountName -eq $null -or $EventData.SamAccountName -eq '' -or $EventData.Description -eq $null -or $EventData.Description -eq '' -or $EventData.PasswordstateList -eq $null -or $EventData.PasswordstateList -eq '' -or $EventData.PasswordstateTitle -eq $null -or $EventData.PasswordstateTitle -eq '') {
|
||||
# ('Office365', 'VMware_Systems', 'CSRC', 'Shared Linux Password List', 'Peoplesoft Share PW', 'Cohesity', 'VDI')
|
||||
New-UDFormValidationResult -ValidationError "All fields are required."
|
||||
}
|
||||
else {
|
||||
if ($FormContent.ADDomain -ne 'nd.gov') {
|
||||
New-UDFormValidationResult -ValidationError "Only nd.gov ADDomain is supported at this time."
|
||||
}
|
||||
else {
|
||||
If (@('Office365', 'VMware_Systems', 'CSRC', 'Shared Linux Password List', 'Peoplesoft Share PW', 'Cohesity', 'VDI') -notcontains $EventData.PasswordstateList) {
|
||||
New-UDFormValidationResult -ValidationError "PasswordstateList must match one of the following: VMware_Systems, Cohesity, VDI, Office365, CSRC, Shared Linux Password List, Peoplesoft Share PW"
|
||||
}
|
||||
}
|
||||
New-UDFormValidationResult -Valid
|
||||
}
|
||||
} -OnSubmit {
|
||||
$InvokePSUScriptParams = @{
|
||||
Script = 'New-ITDADServiceAccountRitm_script.ps1';
|
||||
RequestedForEmail = $EventData.RequestedForEmail
|
||||
ADDomain = $EventData.ADDomain
|
||||
SamAccountName = $EventData.SamAccountName
|
||||
Description = $EventData.Description
|
||||
PasswordstateList = $EventData.PasswordstateList
|
||||
PasswordstateTitle = $EventData.PasswordstateTitle
|
||||
|
||||
}
|
||||
$InvokePSUScriptResult = Invoke-PSUScript @InvokePSUScriptParams -Wait
|
||||
Show-UDToast -Message ("ServiceNow Request " + $InvokePSUScriptResult.number + " created on behalf of $User" ) -Duration 100000
|
||||
|
||||
}
|
||||
}
|
||||
)
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Home' -Content {
|
||||
New-UDTypography -Text 'Home' -Id 'homeText'
|
||||
} -Generated
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
New-UDApp -Title 'NewITDVMwareVMSnapshotTask' -Pages @(
|
||||
New-UDPage -Name "NewITDVMwareVMSnapshotTask" -Content {
|
||||
New-UDForm -Content {
|
||||
New-UDTextbox -Label 'VMName' -Id 'VMName'
|
||||
New-UDTextbox -Label 'HoursToKeep' -Id 'HoursToKeep' -Maximum 72 -Minimum 1 -Type number
|
||||
New-UDDatePicker -Label 'StartDate' -Id "StartDate"
|
||||
New-UDTimePicker -Label 'StartTime' -Id "StartTime"
|
||||
|
||||
} -OnSubmit {
|
||||
$StartDateTime = $EventData.StartDate.Date
|
||||
$StartDateTime = $StartDateTime.AddHours($EventData.StartTime.Hour)
|
||||
$StartDateTime = $StartDateTime.AddMinutes($EventData.StartTime.Minute)
|
||||
Show-UDToast -Message ("Start Date/Time is: " + $StartDateTime + "`n User is " + $User) -Duration 20000
|
||||
}
|
||||
}
|
||||
)
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Home' -Content {
|
||||
New-UDTypography -Text 'Home' -Id 'homeText'
|
||||
} -Generated
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
$Navigation = @(
|
||||
New-UDListItem -Label 'Home' -Icon (New-UDIcon -Icon Home) -OnClick {
|
||||
Invoke-UDRedirect -Url '/home'
|
||||
}
|
||||
New-UDListItem -Label 'Users' -Icon (New-UDIcon -Icon User) -OnClick {
|
||||
Invoke-UDRedirect -Url '/users'
|
||||
}
|
||||
New-UDListItem -Label 'Groups' -Icon (New-UDIcon -Icon Users) -OnClick {
|
||||
Invoke-UDRedirect -Url '/groups'
|
||||
}
|
||||
)
|
||||
|
||||
New-UDApp -Title 'PowerShell Universal' -Pages @(
|
||||
Get-UDPage -Name 'home'
|
||||
Get-UDPage -Name 'users'
|
||||
Get-UDPage -Name 'groups'
|
||||
) -Navigation $Navigation
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Home' -Content {
|
||||
New-UDTypography -Text 'Home' -Id 'homeText'
|
||||
} -Generated
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
New-UDPage -Url "/Users" -Name "Users" -Content {
|
||||
New-UDTypography -Text 'Roles assigned to this user:'
|
||||
New-UDList -Content {
|
||||
$Roles | ForEach-Object{
|
||||
New-UDListItem -Label $_
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
New-UDTypography -Text 'Variables this user can access:'
|
||||
$AllPSUVariables = Get-PSUVariable
|
||||
$TableData = $AllPSUVariables | Select *,@{n='RoleStr';e={$_.Role -join ", "}},@{n='SecretValue';e={$SecretValue=Get-Childitem ("Secret:" + $_.Name) -ErrorAction SilentlyContinue;If($SecretValue -is [string]){"secure_string"}Else{$SecretValue}}},@{n='SecretUsername';e={(Get-Childitem ("Secret:" + $_.Name) -ErrorAction SilentlyContinue).Username}}
|
||||
|
||||
New-UDTable -Columns @(
|
||||
New-UDTableColumn -Property 'Name' -Title 'Name' -ShowFilter
|
||||
New-UDTableColumn -Property 'RoleStr' -Title 'Role' -ShowFilter
|
||||
New-UDTableColumn -Property 'Type' -Title 'Type' -ShowFilter
|
||||
New-UDTableColumn -Property 'Value' -Title 'Value' -ShowFilter
|
||||
New-UDTableColumn -Property 'Secret' -Title 'Secret' -ShowFilter
|
||||
New-UDTableColumn -Property 'SecretValue' -Title 'SecretValue' -ShowFilter
|
||||
New-UDTableColumn -Property 'SecretUsername' -Title 'SecretUsername' -ShowFilter
|
||||
) -Data $TableData -Dense
|
||||
} -Title "Users" -Icon @{
|
||||
type = 'icon'
|
||||
id = '37c13667-6c5a-4cb1-a16b-49eaddd96d03'
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDApp -Title 'PSUVariable' -Content {
|
||||
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Home' -Content {
|
||||
New-UDTypography -Text 'Home' -Id 'homeText'
|
||||
} -Generated
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDApp -Title 'PowerShell Universal' -Pages @(
|
||||
Get-UDPage -Name 'home'
|
||||
)
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Home' -Content {
|
||||
New-UDTypography -Text 'Home' -Id 'homeText'
|
||||
} -Generated
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
$Navigation = @(
|
||||
New-UDListItem -Label 'Home' -OnClick {
|
||||
Invoke-UDRedirect -Url '/Home'
|
||||
}
|
||||
New-UDListItem -Label 'CMDB Ci Lookup' -OnClick {
|
||||
Invoke-UDRedirect -Url '/CMDBServerList'
|
||||
}
|
||||
New-UDListItem -Label 'Server Build Request V1 (Current) Lookup' -OnClick {
|
||||
Invoke-UDRedirect -Url '/ServerBuildRequestV1'
|
||||
}
|
||||
New-UDListItem -Label 'Application Server V2 (Previous) Lookup' -OnClick {
|
||||
Invoke-UDRedirect -Url '/ApplicationServerV2'
|
||||
}
|
||||
New-UDListItem -Label 'AppNameLookup' -OnClick {
|
||||
Invoke-UDRedirect -Url '/AppNameLookup'
|
||||
}
|
||||
New-UDListItem -Label 'CiLookup' -OnClick {
|
||||
Invoke-UDRedirect -Url '/CiLookup'
|
||||
}
|
||||
New-UDListItem -Label 'AzureSizeHelper' -OnClick {
|
||||
Invoke-UDRedirect -Url '/AzureVmSizeHelper'
|
||||
}
|
||||
)
|
||||
AppNameLookup.ps1 - /AppNameLookup
|
||||
New-UDApp -Title 'PowerShell Universal' -Pages @(
|
||||
Get-UDPage -Name 'Home'
|
||||
Get-UDPage -Name 'CMDBServerList'
|
||||
Get-UDPage -Name 'ServerBuildRequestV1'
|
||||
Get-UDPage -Name 'ApplicationServerV2'
|
||||
Get-UDPage -Name 'AppNameLookup'
|
||||
Get-UDPage -Name 'CiLookup'
|
||||
Get-UDPage -Name 'AzureVmSizeHelper'
|
||||
) -Navigation $Navigation
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
New-UDPage -Url "/AppNameLookup" -Name "AppNameLookup" -Content {
|
||||
New-UDTypography -Id "disclaimer" -Text "This is querying the cmdb_ci_service_auto table in ServiceNow. This is live data being shown."
|
||||
|
||||
|
||||
New-ITDServiceNowSession -Environment Production -Credential $Secret:snow_vmcred
|
||||
$PropertyList = @(
|
||||
@{
|
||||
name = "name";
|
||||
expression = { $_.name.display_value };
|
||||
},
|
||||
@{
|
||||
name = "sys_id";
|
||||
expression = { $_.sys_id.value } ;
|
||||
},
|
||||
@{
|
||||
name = "u_primary_systems_admin";
|
||||
expression = { $_.u_primary_systems_admin.display_value } ;
|
||||
},
|
||||
@{
|
||||
name = "u_secondary_systems_admin";
|
||||
expression = { $_.u_secondary_systems_admin.display_value } ;
|
||||
},
|
||||
@{
|
||||
name = 'u_systems_owner';
|
||||
expression = { $_.u_systems_owner.display_value};
|
||||
}
|
||||
)
|
||||
#$Result = Get-ITDServiceNowRecord -Table cmdb_ci_server -Filter ("nameLIKE" + $EventData.CiName) -IncludeTotalCount | Select-Object -Property $PropertyList
|
||||
$GetITDServiceNowRecordParams = @{
|
||||
Table = 'cmdb_ci_service_auto';
|
||||
IncludeTotalCount = $true;
|
||||
Fields = @(
|
||||
'name',
|
||||
'sys_id',
|
||||
'u_primary_systems_admin',
|
||||
'u_secondary_systems_admin',
|
||||
'u_systems_owner'
|
||||
)
|
||||
}
|
||||
$Result = Get-ITDServiceNowRecord @GetITDServiceNowRecordParams | Select-Object -Property $PropertyList
|
||||
$CmdbCiUrl = "https://northdakota.service-now.com/nav_to.do?uri=" + $Result.sys_class_name + ".do?sys_id=" + $Result.sys_id
|
||||
|
||||
New-UDTable -Columns @(
|
||||
New-UDTableColumn -Property 'SNowUrl' -Title 'CmdbCiUrl' -Render { #https://northdakota.service-now.com/nav_to.do?uri=cmdb_ci_win_server.do?sys_id=8bc3ecd11b0154509d7ada01dd4bcb59
|
||||
New-UDLink -Url ("https://northdakota.service-now.com/nav_to.do?uri=cmdb_ci_service_auto.do?sys_id=" + $EventData.sys_id) -Id "lnkSNow" -Content {
|
||||
New-UDImage -Url "https://psuniversal.nd.gov/PSUniversal_Extras/servicenow_logo_icon_168835.png" -Height 20 -Width 20
|
||||
}
|
||||
}
|
||||
New-UDTableColumn -Property 'name' -Title 'name' -ShowSort -ShowFilter
|
||||
#New-UDTableColumn -Property 'sys_id' -Title 'sys_id' -ShowSort -ShowFilter
|
||||
New-UDTableColumn -Property 'u_primary_systems_admin' -Title 'u_primary_systems_admin' -ShowSort -ShowFilter
|
||||
New-UDTableColumn -Property 'u_secondary_systems_admin' -Title 'u_secondary_systems_admin' -ShowSort -ShowFilter
|
||||
New-UDTableColumn -Property 'u_systems_owner' -Title 'u_systems_owner' -ShowSort -ShowFilter
|
||||
) -Data ($Result | sort-object Name) -ShowPagination -Dense -PageSize 50
|
||||
} -Title "AppNameLookup" -Icon @{
|
||||
id = '9fdceac8-807e-4d5e-acda-3d477d77fdb4'
|
||||
type = 'icon'
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
New-UDPage -Url "/ApplicationServerV2" -Name "ApplicationServerV2" -Content {
|
||||
New-UDTypography -Text 'Application Server request items (RITMs) submitted between 2023/02/27 and 2024/06/25 in which the field "VM Work Needed" is set to "Yes"'
|
||||
|
||||
|
||||
$ServerInstance = "itdintsql22p1.nd.gov\INTSQL22P1"
|
||||
$Database = "ITD-Systems-Automation"
|
||||
$Table = 'ServiceNow_RitmDump_ApplicationServerV2'
|
||||
|
||||
$SqlQuery = "SELECT [number],[sys_id],[opened_at],[requested_for],[short_description],[request_type],[application_name],[environment],[additional_comments],[vm_work_needed],[server_name],[host_name],[server_type],[operating_system],[target_platform],[processors],[memory_gb],[cidr_block],[data_center],[licensing_restrictions],[agency_name],[application_info],[support_hours],[dr_protection],[startup_priority],[disk_1_os],[disk_2_swap_disk],[disk_3],[disk_4],[disk_5],[disk_6],[disk_7],[disk_8],[disk_9],[disk_10],[disk_11],[disk_12],[disk_13],[disk_14],[disk_15],[disk_16] FROM [$Database].[dbo].[$Table] WHERE vm_work_needed = '1'"
|
||||
$SqlRecords = Invoke-Sqlcmd -ServerInstance $ServerInstance -Database $Database -Query $SqlQuery -Credential $Secret:sql_itdpsu1 -Verbose
|
||||
|
||||
New-UDTable -Columns @(
|
||||
New-UDTableColumn -Property 'number' -Title 'number' -ShowSort
|
||||
New-UDTableColumn -Property 'opened_at' -Title 'opened_at'
|
||||
New-UDTableColumn -Property 'server_name' -Title 'server_name' -ShowFilter
|
||||
New-UDTableColumn -Property 'host_name' -Title 'host_name' -ShowFilter
|
||||
New-UDTableColumn -Property 'requested_for' -Title 'requested_for' -ShowFilter
|
||||
New-UDTableColumn -Property 'request_type' -Title 'request_type' -ShowFilter
|
||||
New-UDTableColumn -Property 'environment' -Title 'environment' -ShowFilter
|
||||
New-UDTableColumn -Property 'additional_comments' -Title 'additional_comments' -ShowFilter
|
||||
) -Data ($SqlRecords | Select *,@{n='Open';e={$_.sys_id}} | Sort-Object -Descending number) -Dense -ShowPagination -PageSize 20
|
||||
} -Title "ApplicationServerV2" -Icon @{
|
||||
id = 'd9dc64f6-9f4b-432a-866a-d3189529528b'
|
||||
type = 'icon'
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
New-UDPage -Url "/AzureVmSizeHelper" -Name "AzureVmSizeHelper" -Content {
|
||||
$tenantId = '2dea0464-da51-4a88-bae2-b3db94bc0c54'
|
||||
$AppId = '60244573-7130-4026-9c6d-47de73f8ca29'
|
||||
$SecureStringPwd = $Secret:azure_iaasserviceprincipal
|
||||
$PSCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $AppId, ($SecureStringPwd | ConvertTo-SecureString -AsPlainText -Force)
|
||||
Connect-AzAccount -ServicePrincipal -Credential $PSCredential -Tenant $tenantId
|
||||
|
||||
$TableData = Get-AzVmSize -Location centralus | Select *,`
|
||||
@{n='MemoryInGB';e={$_.MemoryInMb / 1024}}, `
|
||||
@{n='OSDiskSizeInGB'; e={$_.OsDiskSizeInMb / 1024}}, `
|
||||
@{n='ResourceDiskSizeInGB'; e={$_.ResourceDiskSizeInMB / 1024}} | Sort-Object NumberOfCores,MemoryInGB
|
||||
|
||||
New-UDTable -Columns @(
|
||||
New-UDTableColumn -Property 'Name' -Title 'Name' -ShowSort -ShowFilter
|
||||
New-UDTableColumn -Property 'NumberOfCores' -Title 'NumberOfCores' -ShowSort -ShowFilter
|
||||
New-UDTableColumn -Property 'MemoryInGB' -Title 'MemoryInGB' -ShowFilter -ShowSort
|
||||
New-UDTableColumn -Property 'OSDiskSizeInGB' -Title 'OSDiskSizeInGB' -ShowFilter -ShowSort
|
||||
New-UDTableColumn -Property 'ResourceDiskSizeInGB' -Title 'ResourceDiskSizeInGB' -ShowFilter -ShowSort
|
||||
) -Data $TableData -Dense
|
||||
} -Title "AzureVmSizeHelper" -Icon @{
|
||||
type = 'icon'
|
||||
id = 'f45c0541-5f78-4c00-899b-548e1bbabb04'
|
||||
}
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
New-UDPage -Url "/CMDBServerList" -Name "CMDBServerList" -Content {
|
||||
# Use Get-UDPage -Name 'CmdbServer' to use this page in your dashboard
|
||||
|
||||
<#
|
||||
New-UDCard -Content {
|
||||
New-UDList -children {
|
||||
New-UDListItem -Label "Enter the Name of the Cmdb Ci. Usually host name, not FQDN. `nFor example: itdsccmp2.nd.gov, enter itdsccmp2. The search is using 'LIKE' comparsion operator, so wildcards are automatically applied at both sides of the entered value. "
|
||||
New-UDListItem -Label 'This search is a live query of the ServiceNow Cmdb.'
|
||||
New-UDListItem -Label 'This is a work in progress. Use at your own discretion.'
|
||||
}
|
||||
}#>
|
||||
|
||||
|
||||
|
||||
|
||||
New-UDForm -Id 'CiLookup' -Content {
|
||||
New-UDRow -Columns {
|
||||
New-UDColumn -SmallSize 6 -LargeSize 6 -Content {
|
||||
New-UDTextbox -Id 'CiName'
|
||||
}
|
||||
}
|
||||
} -OnValidate {
|
||||
$FormContent = $EventData
|
||||
if ($FormContent.CiName -eq $null -or $FormContent.VMName -eq '') {
|
||||
New-UDFormValidationResult -ValidationError "CiName is required"
|
||||
}
|
||||
else {
|
||||
New-UDFormValidationResult -Valid
|
||||
}
|
||||
} -OnSubmit {
|
||||
Show-UDToast -Message ("Querying ServiceNow table cmdb_ci_server for record with name " + $EventData.Name) -Duration 20000
|
||||
|
||||
New-ITDServiceNowSession -Environment Production -Credential $Secret:snow_vmcred
|
||||
$PropertyList = @(
|
||||
@{
|
||||
name = "name";
|
||||
expression = { $_.name.display_value };
|
||||
},
|
||||
@{
|
||||
name = "dns_domain";
|
||||
expression = { $_.dns_domain.display_value } ;
|
||||
},
|
||||
@{
|
||||
name = "environment";
|
||||
expression = { $_.environment.display_value } ;
|
||||
},
|
||||
@{
|
||||
name = 'operational_status';
|
||||
expression = { $_.operational_status.display_value};
|
||||
}
|
||||
@{
|
||||
name = 'sys_id';
|
||||
expression = { $_.sys_id.value };
|
||||
}
|
||||
@{
|
||||
name = 'sys_class_name';
|
||||
expression = { $_.sys_class_name.value }
|
||||
},
|
||||
@{
|
||||
name = "u_nd_type";
|
||||
expression = { $_.u_nd_type.display_value }
|
||||
},
|
||||
@{
|
||||
name = "u_nd_application_svc";
|
||||
expression = { $_.u_nd_application_svc.display_value }
|
||||
},
|
||||
@{
|
||||
name = "u_nd_licensing_restrictions";
|
||||
expression = { $_.u_nd_licensing_restrictions.display_value }
|
||||
},
|
||||
@{
|
||||
name = "u_support_hours";
|
||||
expression = { $_.u_support_hours.display_value }
|
||||
},
|
||||
@{
|
||||
name = "u_nd_dr_protection";
|
||||
expression = { $_.u_nd_dr_protection.display_value };
|
||||
},
|
||||
@{
|
||||
name = "u_srm_recovery_type";
|
||||
expression = { $_.u_srm_recovery_type.display_value }
|
||||
},
|
||||
@{
|
||||
name = "os";
|
||||
expression = { $_.os.display_value }
|
||||
},
|
||||
@{
|
||||
name = "os_version";
|
||||
expression = { $_.os_version.display_value }
|
||||
},
|
||||
@{
|
||||
name = "model_id";
|
||||
expression = { $_.model_id.display_value }
|
||||
}
|
||||
)
|
||||
#$Result = Get-ITDServiceNowRecord -Table cmdb_ci_server -Filter ("nameLIKE" + $EventData.CiName) -IncludeTotalCount | Select-Object -Property $PropertyList
|
||||
$GetITDServiceNowRecordParams = @{
|
||||
#Filter = "model_id=3161ee6c1bf810502653997fbd4bcb4c^ORmodel_id%253Da75f244c1bd75014bba0113fad4bcb72"
|
||||
Filter = "model_idLIKEVMware^ORmodel_idLIKEMicrosoft"
|
||||
Table = 'cmdb_ci_server';
|
||||
IncludeTotalCount = $true;
|
||||
Fields = @(
|
||||
'name',
|
||||
'sys_id',
|
||||
'dns_domain',
|
||||
'sys_class_name',
|
||||
'operational_status',
|
||||
'environment',
|
||||
'u_nd_type',
|
||||
'model_id',
|
||||
'os',
|
||||
'os_version',
|
||||
'u_nd_application_svc',
|
||||
'u_nd_licensing_restrictions',
|
||||
'u_nd_dr_protection',
|
||||
'u_srm_recovery_type',
|
||||
'u_support_hours'
|
||||
)
|
||||
}
|
||||
$Result = Get-ITDServiceNowRecord @GetITDServiceNowRecordParams | Select-Object -Property $PropertyList
|
||||
$CmdbCiUrl = "https://northdakota.service-now.com/nav_to.do?uri=" + $Result.sys_class_name + ".do?sys_id=" + $Result.sys_id
|
||||
|
||||
New-UDTable -Columns @(
|
||||
New-UDTableColumn -Property 'CmdbCiUrl' -Title 'CmdbCiUrl' -Render { #https://northdakota.service-now.com/nav_to.do?uri=cmdb_ci_win_server.do?sys_id=8bc3ecd11b0154509d7ada01dd4bcb59
|
||||
New-UDLink -Url ("https://northdakota.service-now.com/nav_to.do?uri=" + $EventData.sys_class_name + ".do?sys_id=" + $EventData.sys_id) -Id "lnkCmdbCi" -Content {
|
||||
New-UDImage -Url "https://psuniversal.nd.gov/PSUniversal_Extras/servicenow_logo_icon_168835.png" -Height 20 -Width 20
|
||||
}
|
||||
}
|
||||
New-UDTableColumn -Property 'name' -Title 'name' -ShowSort -ShowFilter
|
||||
New-UDTableColumn -Property 'dns_domain' -Title 'dns_domain' -ShowFilter
|
||||
New-UDTableColumn -Property 'u_nd_application_svc' -Title 'u_nd_application_svc' -ShowFilter
|
||||
New-UDTableColumn -Property 'environment' -Title 'environment' -ShowFilter
|
||||
New-UDTableCOlumn -Property 'operational_status' -Title 'operational_status' -ShowFilter
|
||||
New-UDTableColumn -Property 'u_nd_type' -Title 'u_nd_type' -ShowFilter
|
||||
#New-UDTableColumn -Property 'model_id' -Title 'model_id' -ShowFilter
|
||||
#New-UDTableColumn -Property 'os' -Title 'os' -ShowFilter
|
||||
#New-UDTableColumn -Property 'os_version' -Title 'os_version' -ShowFilter
|
||||
New-UDTableColumn -Property 'u_nd_licensing_restrictions' -Title 'u_nd_licensing_restrictions' -ShowFilter
|
||||
New-UDTableColumn -Property 'u_support_hours' -Title 'u_support_hours' -ShowFilter
|
||||
New-UDTableColumn -Property 'u_nd_dr_protection' -Title 'u_nd_dr_protection' -ShowFilter
|
||||
New-UDTableColumn -Property 'u_srm_recovery_type' -Title 'u_srm_recovery_type' -ShowFilter
|
||||
) -Data ($Result | sort-object Name) -ShowPagination -Dense -PageSize 50
|
||||
|
||||
|
||||
} -OnProcessing {
|
||||
|
||||
}
|
||||
|
||||
|
||||
New-UDCard -Id 'Result'
|
||||
} -Title "CMDBServerList" -Icon @{
|
||||
id = 'dc0de7d9-022b-4e24-a7c7-7f0e59710542'
|
||||
type = 'icon'
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
New-UDPage -Url "/CiLookup" -Name "CiLookup" -Content {
|
||||
New-UDGrid -Container -Children {
|
||||
New-UDGrid -Item -ExtraSmallSize 4 -Children {
|
||||
New-UDCard -Title "General Information" -Content {
|
||||
#New-UDButton -Text "Button 1"
|
||||
New-UDRow -Columns {
|
||||
New-UDColumn -Size 4 -Content {
|
||||
New-UDTextBox -Label "Name" -Id "Name" -Value "itddefghijklmno.ndcloud.gov" -FullWidth
|
||||
}
|
||||
New-UDColumn -Size 4 -Content {
|
||||
New-UDTextBox -Label "LicensingRestrictions" -Id "LicensingRestrictions" -Value "Microsoft SQL Enterprise"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
New-UDGrid -Item -ExtraSmallSize 4 -Children {
|
||||
New-UDCard -Title "Support Information" -Content {
|
||||
#New-UDButton -Text "Button 2"
|
||||
New-UDRow -Columns {
|
||||
New-UDColumn -Size 4 -Content {
|
||||
New-UDTextBox -Label "AppName" -Id "AppName"
|
||||
}
|
||||
New-UDColumn -Size 4 -Content {
|
||||
New-UDTextBox -Label "Support Hours" -Id "Support Hours"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} -Id "GridGeneral"
|
||||
|
||||
New-UDContainer -Content {
|
||||
New-UDLayout -Columns 2 - -Content {
|
||||
#New-UDTypography "Row 1, Col 1"
|
||||
New-UDTextBox -Label "Name" -Value "itddefghijklmno.ndcloud.gov" -FullWidth
|
||||
#New-UDTypography "Row 1, Col 2"
|
||||
New-UDTextBox -Label "AppName" -Value "Infra-POS-SomeStupidApp" -FullWidth
|
||||
New-UDTypography "Row 2, Col 1"
|
||||
New-UDTypography "Row 2, Col 2"
|
||||
}
|
||||
}
|
||||
|
||||
$tablePwd = [ordered]@{
|
||||
'Password Expiration' = "itdsomething.nd.gov"
|
||||
'Account Expiration' = "ITD-POS-StupidName"
|
||||
'Last Logon Timestamp' = "Microsoft SQL Enterperise"
|
||||
}
|
||||
|
||||
|
||||
$Data = , @($tablePwd.GetEnumerator())
|
||||
$DateColumns = @(
|
||||
New-UDTableColumn -Property Name -Title " "
|
||||
New-UDTableColumn -Property Value -Title " "
|
||||
)
|
||||
New-UDTable -Id "PasswordInfo" -Title "Password and Account Info" -Data $Data[0] -Columns $DateColumns -Dense
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
New-UDButton -Text 'Full Width' -OnClick {
|
||||
Show-UDModal -Content {
|
||||
New-UDGrid -Container -Children {
|
||||
New-UDCard -Title "General" -Content {
|
||||
New-UDElement -Tag 'div' -Id 'addElement'
|
||||
New-UDTextBox -Id "Name" -Label "Name" -Value "servernamehere.nd.gov"
|
||||
New-UDTextBox -Id "Operational Status" -Label "Status" -Value "Operational"
|
||||
New-UDTextBox -Id "AppName" -Label "AppName" -Value "ITD-POS-StupidNameHere"
|
||||
New-UDTextBox -Id "Support Hours" -Label "Support Hours" -Value "All Day Every Day"
|
||||
}
|
||||
New-UDCard -Title "Hardware" -Content {
|
||||
New-UDTextBox -Id "Datacenter" -Label "Datacenter" -Value "Bismarck"
|
||||
New-UDTextBox -Id "Environment" -Label "Environment" -Value "Production"
|
||||
New-UDTextBox -Id "DR Protection" -Label "DR Protection" -Value "VMware: RPO 04:00"
|
||||
New-UDTextBox -Id "Datacenter" -Label "Datacenter" -Value "Bismarck"
|
||||
New-UDTextBox -Id "Environment" -Label "Environment" -Value "Production"
|
||||
New-UDTextBox -Id "DR Protection" -Label "DR Protection" -Value "VMware: RPO 04:00"
|
||||
New-UDTextBox -Id "OperatingSystem" -Label "Operating System" -Value "Windows Server 2022"
|
||||
New-UDTextBox -Id "CPU" -Label "CPU" -Value "4"
|
||||
New-UDTextBox -Id "MemoryGB" -Label "MemoryGB" -Value "12"
|
||||
New-UDTextBox -Id "DiskGB" -Label "DiskGB" -Value "1197"
|
||||
}
|
||||
New-UDCard -Title "Software" -Content {
|
||||
New-UDTextBox -Id "LicensingRestrictions" -Label "LicensingRestrictions" -Value "Microsoft SQL Enterprise"
|
||||
New-UDTextBox -Id "OperatingSystem" -Label "Operating System" -Value "Windows Server 2022"
|
||||
}
|
||||
}
|
||||
|
||||
#New-UDDynamic
|
||||
} -FullWidth -MaxWidth 'md'
|
||||
}
|
||||
} -Title "CiLookup" -Icon @{
|
||||
id = '3743b2ed-0278-4678-8a47-e22ad4514afb'
|
||||
type = 'icon'
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
New-UDPage -Url "/CiTest" -Name "CiTest" -Content {
|
||||
|
||||
} -Title "CiTest" -Icon @{
|
||||
} -Generated
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
New-UDPage -Url "/ServerBuildRequestV1" -Name "ServerBuildRequestV1" -Content {
|
||||
New-UDTypography -Text "`nServer Build Request request items (RITMs) submitted after 2024/06/25"
|
||||
|
||||
$ServerInstance = "itdintsql22p1.nd.gov\INTSQL22P1"
|
||||
$Database = "ITD-Systems-Automation"
|
||||
$Table = 'ServiceNow_RitmDump_ServerBuildRequestV1'
|
||||
|
||||
New-ITDServiceNowSession -Environment Production -Credential $Secret:snow_vmcred
|
||||
|
||||
$SqlQuery = "SELECT [RitmNum],
|
||||
[RitmSysId],
|
||||
[opened_at],
|
||||
[requested_for],
|
||||
[request_type],
|
||||
[environment]
|
||||
,[host_name_ref]
|
||||
,[host_name]
|
||||
FROM [ITD-Systems-Automation].[dbo].[ServiceNow_RitmDump_ServerBuildRequestV1]"
|
||||
$SqlRecords = Invoke-Sqlcmd -ServerInstance $ServerInstance -Database $Database -Query $SqlQuery -Credential $Secret:sql_itdpsu1 -Verbose
|
||||
|
||||
|
||||
|
||||
New-UDTable -Dense -ShowPagination -PageSize 20 -Size small -Data ($SqlRecords | Sort-Object -Descending opened_at) -Columns @(
|
||||
New-UDTableColumn -Property 'RitmUrl' -Title 'RitmUrl' -Render {
|
||||
New-UDLink -Url ("https://northdakota.service-now.com/nav_to.do?uri=sc_req_item.do?sys_id=" + $EventData.RitmSysId) -Id "lnkRitm" -Content {
|
||||
New-UDImage -Url "https://psuniversal.nd.gov/PSUniversal_Extras/servicenow_logo_icon_168835.png" -Height 20 -Width 20
|
||||
}
|
||||
}
|
||||
|
||||
New-UDTableColumn -Property 'RitmNum' -Title 'RitmNum' -ShowFilter
|
||||
New-UDTableColumn -Property 'opened_at' -Title 'opened_at' -ShowFilter
|
||||
New-UDTableColumn -Property 'host_name' -Title 'host_name' -ShowFilter
|
||||
New-UDTableColumn -Property 'requested_for' -Title 'requested_for' -ShowFilter
|
||||
New-UDTableColumn -Property 'request_type' -Title 'request_type' -ShowFilter
|
||||
New-UDTableColumn -Property 'environment' -Title 'environment' -ShowFilter
|
||||
#New-UDTableColumn -Property 'additional_comments' -Title 'additional_comments' -ShowFilter
|
||||
)
|
||||
} -Title "ServerBuildRequestV1" -Icon @{
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
New-UDPage -Url "/Home" -Name "Home" -Content {
|
||||
New-UDTypography -text 'Use left side navigation to view various ServiceNow queries' -id 'homeText' -noWrap
|
||||
} -Generated -Layout (
|
||||
New-UDPageLayout -Large @(
|
||||
New-UDItemLayout -Id 'homeText' -Row 0 -Column 0 -RowSpan 1 -ColumnSpan 1
|
||||
) -Medium @(
|
||||
) -Small @(
|
||||
) -ExtraSmall @(
|
||||
) -ExtraExtraSmall @(
|
||||
)
|
||||
)
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
$Navigation = @(
|
||||
New-UDListItem -Label 'Home' -OnClick {
|
||||
Invoke-UDRedirect -Url '/Home'
|
||||
}
|
||||
New-UDListItem -Label 'ServerBuildRequestV1' -OnClick {
|
||||
Invoke-UDRedirect -Url '/ServerBuildRequestV1'
|
||||
}
|
||||
New-UDListItem -Label 'ApplicationServerV2' -OnClick {
|
||||
Invoke-UDRedirect -Url '/ApplicationServerV2'
|
||||
}
|
||||
New-UDListItem -Label 'SpCmdbCompare' -OnClick {
|
||||
Invoke-UDRedirect -Url '/SpCmdbCompare'
|
||||
}
|
||||
)
|
||||
|
||||
New-UDApp -Title 'PowerShell Universal' -Pages @(
|
||||
Get-UDPage -Name 'Home'
|
||||
Get-UDPage -Name 'ApplicationServerV2'
|
||||
Get-UDPage -Name 'ServerBuildRequestV1'
|
||||
Get-UDPage -Name 'SpCmdbCompare'
|
||||
) -Navigation $Navigation
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
New-UDPage -Url "/ApplicationServerV2" -Name "ApplicationServerV2" -Content {
|
||||
New-UDTypography -Text 'Application Server request items (RITMs) submitted between 2023/02/27 and 2024/06/25 in which the field "VM Work Needed" is set to "Yes"'
|
||||
|
||||
|
||||
$ServerInstance = "itdintsql22p1.nd.gov\INTSQL22P1"
|
||||
$Database = "ITD-Systems-Automation"
|
||||
$Table = 'ServiceNow_RitmDump_ApplicationServerV2'
|
||||
|
||||
$SqlQuery = "SELECT [number],[sys_id],[opened_at],[requested_for],[short_description],[request_type],[application_name],[environment],[additional_comments],[vm_work_needed],[server_name],[host_name],[server_type],[operating_system],[target_platform],[processors],[memory_gb],[cidr_block],[data_center],[licensing_restrictions],[agency_name],[application_info],[support_hours],[dr_protection],[startup_priority],[disk_1_os],[disk_2_swap_disk],[disk_3],[disk_4],[disk_5],[disk_6],[disk_7],[disk_8],[disk_9],[disk_10],[disk_11],[disk_12],[disk_13],[disk_14],[disk_15],[disk_16] FROM [$Database].[dbo].[$Table] WHERE vm_work_needed = '1'"
|
||||
$SqlRecords = Invoke-Sqlcmd -ServerInstance $ServerInstance -Database $Database -Query $SqlQuery -Credential $Secret:sql_itdpsu1 -Verbose
|
||||
|
||||
New-UDTable -Columns @(
|
||||
New-UDTableColumn -Property 'number' -Title 'number' -ShowSort
|
||||
New-UDTableColumn -Property 'opened_at' -Title 'opened_at'
|
||||
New-UDTableColumn -Property 'server_name' -Title 'server_name' -ShowFilter
|
||||
New-UDTableColumn -Property 'host_name' -Title 'host_name' -ShowFilter
|
||||
New-UDTableColumn -Property 'requested_for' -Title 'requested_for' -ShowFilter
|
||||
New-UDTableColumn -Property 'request_type' -Title 'request_type' -ShowFilter
|
||||
New-UDTableColumn -Property 'environment' -Title 'environment' -ShowFilter
|
||||
New-UDTableColumn -Property 'additional_comments' -Title 'additional_comments' -ShowFilter
|
||||
) -Data ($SqlRecords | Select *,@{n='Open';e={$_.sys_id}} | Sort-Object -Descending number) -Dense -ShowPagination -PageSize 20
|
||||
} -Icon @{
|
||||
type = 'icon'
|
||||
id = 'e91ed4ef-cecd-448a-9204-2b453db9db03'
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Home' -Content {
|
||||
New-UDTypography -Text 'Home' -Id 'homeText'
|
||||
} -Generated
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
New-UDPage -Url "/ServerBuildRequestV1" -Name "ServerBuildRequestV1" -Content {
|
||||
New-UDForm -Content {
|
||||
New-UDTypography -Text 'To sync vCenter to Sharepoint, enter a VMware VM name below and click the Submit button'
|
||||
New-UDRow -Columns {
|
||||
New-UDColumn -SmallSize 6 -LargeSize 6 -Content {
|
||||
New-UDTextbox -Id 'VMName'
|
||||
}
|
||||
}
|
||||
} -OnValidate {
|
||||
$FormContent = $EventData
|
||||
if ($FormContent.VMName -eq $null -or $FormContent.VMName -eq '') {
|
||||
New-UDFormValidationResult -ValidationError "VMName is required"
|
||||
}
|
||||
else {
|
||||
New-UDFormValidationResult -Valid
|
||||
}
|
||||
} -OnSubmit {
|
||||
Show-UDToast -Message ($EventData.VMName + " sync in progress.") -Duration 5000
|
||||
|
||||
Invoke-PSUScript -Script 'Sync-ITDVMwareVMMetadataToSharePoint.ps1' -VMName $EventData.VMName -Wait | Out-Null
|
||||
|
||||
Show-UDToast -Message ($EventData.VMName + " sync finished.") -Duration 10000
|
||||
} -OnProcessing {
|
||||
New-UDTypography -Text ("Syncing " + $EventData.VMName + " ...")
|
||||
New-UDProgress
|
||||
}
|
||||
|
||||
New-UDTypography -Text "`nServer Build Request request items (RITMs) submitted after 2024/06/25"
|
||||
|
||||
$ServerInstance = "itdintsql22p1.nd.gov\INTSQL22P1"
|
||||
$Database = "ITD-Systems-Automation"
|
||||
$Table = 'ServiceNow_RitmDump_ServerBuildRequestV1'
|
||||
|
||||
New-ITDServiceNowSession -Environment Production -Credential $Secret:snow_vmcred
|
||||
|
||||
$SqlQuery = "SELECT [RitmNum],
|
||||
[RitmSysId],
|
||||
[opened_at],
|
||||
[requested_for],
|
||||
[request_type],
|
||||
[environment]
|
||||
,[host_name_ref]
|
||||
,[host_name]
|
||||
FROM [ITD-Systems-Automation].[dbo].[ServiceNow_RitmDump_ServerBuildRequestV1]"
|
||||
$SqlRecords = Invoke-Sqlcmd -ServerInstance $ServerInstance -Database $Database -Query $SqlQuery -Credential $Secret:sql_itdpsu1 -Verbose
|
||||
|
||||
|
||||
|
||||
New-UDTable -Dense -ShowPagination -PageSize 20 -Size small -Data ($SqlRecords | Sort-Object -Descending opened_at) -Columns @(
|
||||
New-UDTableColumn -Property 'NewSP' -Title 'New' -Render {
|
||||
New-UDButton -Id "btnNewSP$($EventData.host_name)" -Text "New" -Color Secondary -Size small -OnClick {
|
||||
Show-UDToast -Message ("Creating new record " + $EventData.host_name) -Duration 5000
|
||||
switch($EventData.request_type){
|
||||
'New' {
|
||||
$Fqdn = $EventData.host_name
|
||||
$RitmNum = $EventData.RitmNum
|
||||
|
||||
Invoke-PSUScript -Script 'New-ITDVMwareSharePointVMRecordFromRITM.ps1' -Fqdn $Fqdn -RitmNum $RitmNum
|
||||
}
|
||||
'Removal' {
|
||||
$Fqdn = $EventData.host_name
|
||||
$RitmNum = $EventData.RitmNum
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
New-UDTableColumn -Property 'SyncSP' -Title 'SyncVCtoSP' -Render {
|
||||
New-UDButton -Id "btnSyncSP$($EventData.host_name)" -Text "Sync" -Color primary -Size small -OnClick {
|
||||
Show-UDToast -Message ("Sync to SharePoint - " + $EventData.host_name) -Duration 5000
|
||||
switch($EventData.request_type){
|
||||
'Change' {
|
||||
$Ritm = Get-ITDServiceNowRecord -ItemType 'Request Item' -Number $EventData.RitmNum -IncludeVariableSet
|
||||
ForEach($row in $Ritm.VariableSet){
|
||||
$Cmdb_Ci = Get-ITDServiceNowRecord -Table 'cmdb_ci_server' -SysId $row.host_name_ref
|
||||
If ($Cmdb_Ci.name.display_value -eq $EventData.host_name){
|
||||
$Fqdn = $Cmdb_Ci.fqdn.display_value
|
||||
}
|
||||
}
|
||||
Invoke-PSUScript -Script 'Sync-ITDVMwareVMMetadataToSharePoint.ps1' -VMName $Fqdn -Wait | Out-Null
|
||||
}
|
||||
'New' {
|
||||
$Fqdn = $EventData.host_name
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
New-UDTableColumn -Property "ImplSRM" -Title 'ImplSRMtoSP' -Render {
|
||||
New-UDButton -Id "btnImplSRM$($EventData.host_name)" -Text "SRM" -Color secondary -Size small -OnClick {
|
||||
Show-UDToast -Message ("Sync to SharePoint - " + $EventData.host_name) -Duration 5000
|
||||
switch($EventData.request_type){
|
||||
'Change' {
|
||||
$Ritm = Get-ITDServiceNowRecord -ItemType 'Request Item' -Number $EventData.RitmNum -IncludeVariableSet
|
||||
ForEach($row in $Ritm.VariableSet){
|
||||
$Cmdb_Ci = Get-ITDServiceNowRecord -Table 'cmdb_ci_server' -SysId $row.host_name_ref
|
||||
If ($Cmdb_Ci.name.display_value -eq $EventData.host_name){
|
||||
$Fqdn = $Cmdb_Ci.fqdn.display_value
|
||||
}
|
||||
}
|
||||
}
|
||||
'New' {
|
||||
$Fqdn = $EventData.host_name
|
||||
}
|
||||
}
|
||||
Invoke-PSUScript -Script 'Sync-ITDVMwareVMMetadataToSharePoint.ps1' -VMName $Fqdn -SRMImplemented -Wait | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
New-UDTableColumn -Property 'RitmUrl' -Title 'RitmUrl' -Render {
|
||||
New-UDLink -Url ("https://northdakota.service-now.com/nav_to.do?uri=sc_req_item.do?sys_id=" + $EventData.RitmSysId) -Id "lnkRitm" -Content {
|
||||
New-UDImage -Url "https://psuniversal.nd.gov/PSUniversal_Extras/servicenow_logo_icon_168835.png" -Height 20 -Width 20
|
||||
}
|
||||
}
|
||||
|
||||
New-UDTableColumn -Property 'RitmNum' -Title 'RitmNum' -ShowFilter
|
||||
New-UDTableColumn -Property 'opened_at' -Title 'opened_at' -ShowFilter
|
||||
New-UDTableColumn -Property 'host_name' -Title 'host_name' -ShowFilter
|
||||
New-UDTableColumn -Property 'requested_for' -Title 'requested_for' -ShowFilter
|
||||
New-UDTableColumn -Property 'request_type' -Title 'request_type' -ShowFilter
|
||||
New-UDTableColumn -Property 'environment' -Title 'environment' -ShowFilter
|
||||
#New-UDTableColumn -Property 'additional_comments' -Title 'additional_comments' -ShowFilter
|
||||
)
|
||||
} -Icon @{
|
||||
id = '7d67b921-68aa-4085-84e8-025e92671771'
|
||||
type = 'icon'
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
New-UDPage -Url "/SpCmdbCompare" -Name "SpCmdbCompare" -Content {
|
||||
# Use Get-UDPage -Name 'SpCmdbCompare' to use this page in your dashboard
|
||||
##
|
||||
|
||||
New-UDForm -Content {
|
||||
New-UDTypography -Text 'Enter FQDN to Compare'
|
||||
New-UDRow -Columns {
|
||||
New-UDColumn -SmallSize 6 -LargeSize 6 -Content {
|
||||
New-UDTextbox -Id 'VMName'
|
||||
}
|
||||
}
|
||||
} -OnValidate {
|
||||
$FormContent = $EventData
|
||||
if ($FormContent.VMName -eq $null -or $FormContent.VMName -eq '') {
|
||||
New-UDFormValidationResult -ValidationError "VMName is required"
|
||||
}
|
||||
else {
|
||||
New-UDFormValidationResult -Valid
|
||||
}
|
||||
} -OnSubmit {
|
||||
New-ITDServiceNowSession -Environment Production -Credential $Secret:snow_vmcred
|
||||
#Invoke-PSUScript -Script 'Sync-ITDVMwareVMMetadataToSharePoint.ps1' -VMName $EventData.VMName -Wait | Out-Null
|
||||
$SPItem = Get-ITDVMwareSharePointVMGuestList -Credential $Secret:ndgov_svcitdiaassprw | Where-Object Title -eq $EventData.VMName
|
||||
$Hostname = $SPItem.Title.split('.')[0]
|
||||
$Cmdb = Get-ITDServiceNowRecord -Table cmdb_ci_server -Filter "name=$HostName"
|
||||
|
||||
New-UDLink -Url ("https://northdakota.service-now.com/nav_to.do?uri=" + $Cmdb.sys_class_name.value + ".do?sys_id=" + $Cmdb.sys_id.value) -Id "lnkCmdbCi" -Text "Open Cmdb Record"
|
||||
New-UDLink -Url ("https://northdakota.service-now.com/now/nav/ui/classic/params/target/cmdb_ci_server_list.do%3Fsysparm_query%3DnameSTARTSWITH$HostName") -Text "Open Cmdb Table View"
|
||||
|
||||
New-UDTypography -Text "SpTitle and Cmdb HostName" -Variant h5
|
||||
New-UDTextBox -Id SpTitle -Value $SPItem.Title
|
||||
New-UDTextBox -Id SpTitle -Value $Cmdb.name.display_value
|
||||
|
||||
New-UDTypography -Text "Environment" -Variant h5
|
||||
New-UDButton -Id "btnEnvironment" -Text "Push Environment to Cmdb" -Color Secondary -Size small -OnClick {
|
||||
Update-ITDServiceNowRecord -Table cmdb_ci_server -SysId $Cmdb.sys_id.value -Values @{environment = $SPItem.Environment}
|
||||
}
|
||||
New-UDTextBox -Id SpTitle -Value $SPItem.Environment
|
||||
New-UDTextBox -Id SpTitle -Value $Cmdb.environment.display_value
|
||||
|
||||
New-UDTypography -Text "AppName" -Variant h5
|
||||
New-UDButton -Id "btnAppName" -Text "Push AppName to Cmdb" -Color Secondary -Size small -OnClick {
|
||||
Update-ITDServiceNowRecord -Table cmdb_ci_server -SysId $Cmdb.sys_id.value -Values @{u_nd_application_svc = $SPItem.AppName}
|
||||
}
|
||||
New-UDTextBox -Id SpTitle -Value $SPItem.AppName
|
||||
New-UDTextBox -Id SpTitle -Value $Cmdb.u_nd_application_svc.display_value
|
||||
|
||||
New-UDTypography -Text "LicensingRestrictions" -Variant h5
|
||||
New-UDButton -Id "btnLicesning" -Text "Push Licensing to Cmdb" -Color Secondary -Size small -OnClick {
|
||||
Update-ITDServiceNowRecord -Table cmdb_ci_server -SysId $Cmdb.sys_id.value -Values @{u_nd_licensing_restrictions = $SPItem.LicensingRestrictions}
|
||||
}
|
||||
New-UDTextBox -Id SpTitle -Value $SPItem.LicensingRestrictions
|
||||
New-UDTextBox -Id SpTitle -Value $Cmdb.u_nd_licensing_restrictions.display_value
|
||||
|
||||
New-UDTypography -Text "DR_Protection" -Variant h5
|
||||
New-UDButton -Id "btnDRProtection" -Text "Push DR_Protection to Cmdb" -Color Secondary -Size small -OnClick {
|
||||
Update-ITDServiceNowRecord -Table cmdb_ci_server -SysId $Cmdb.sys_id.value -Values @{u_nd_dr_protection = $SPItem.DR_Protection}
|
||||
}
|
||||
New-UDTextBox -Id SpTitle -Value $SPItem.DR_Protection
|
||||
New-UDTextBox -Id SpTitle -Value $Cmdb.u_nd_dr_protection.display_value
|
||||
|
||||
New-UDTypography -Text "SRM Recovery Type" -Variant h5
|
||||
New-UDButton -Id "btnSRMRecoveryType" -Text "Push SRM Recovery Type to Cmdb" -Color Secondary -Size small -OnClick {
|
||||
Update-ITDServiceNowRecord -Table cmdb_ci_server -SysId $Cmdb.sys_id.value -Values @{u_srm_recovery_type = $SPItem.SRM_RecoveryVMtype}
|
||||
}
|
||||
New-UDTextBox -Id SpTitle -Value $SPItem.SRM_RecoveryVMtype
|
||||
New-UDTextBox -Id SpTitle -Value $Cmdb.u_srm_recovery_type.display_value
|
||||
|
||||
}
|
||||
} -Title "SpCmdbCompare" -Icon @{
|
||||
id = '1d8ccbbe-f274-4e34-bc59-6ed19e2dfa0e'
|
||||
type = 'icon'
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDApp -Title 'PowerShell Universal' -Pages @(
|
||||
Get-UDPage -Name 'home'
|
||||
)
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Home' -Content {
|
||||
New-UDTypography -Text 'Home' -Id 'homeText'
|
||||
} -Generated
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
New-UDApp -Title 'SyncVMwareVMtoSharePoint' -Pages @(
|
||||
New-UDPage -Name "Home" -Content {
|
||||
New-UDForm -Content {
|
||||
New-UDTypography -Text 'Enter a VMware VM name below and click the Submit button'
|
||||
New-UDRow -Columns {
|
||||
New-UDColumn -SmallSize 6 -LargeSize 6 -Content {
|
||||
New-UDTextbox -Id 'VMName'
|
||||
}
|
||||
}
|
||||
} -OnValidate {
|
||||
$FormContent = $EventData
|
||||
|
||||
if ($FormContent.VMName -eq $null -or $FormContent.VMName -eq '') {
|
||||
New-UDFormValidationResult -ValidationError "VMName is required"
|
||||
} else {
|
||||
New-UDFormValidationResult -Valid
|
||||
}
|
||||
} -OnSubmit {
|
||||
Show-UDToast -Message ($EventData.VMName + " sync in progress.") -Duration 5000
|
||||
|
||||
Invoke-PSUScript -Script 'Sync-ITDVMwareVMMetadataToSharePoint_script.ps1' -VMName $EventData.VMName -Wait | Out-Null
|
||||
|
||||
Show-UDToast -Message ($EventData.VMName + " sync finished.") -Duration 10000
|
||||
} -OnProcessing {
|
||||
New-UDTypography -Text ("Syncing " + $EventData.VMName + " ...")
|
||||
New-UDProgress
|
||||
}
|
||||
}
|
||||
)
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Home' -Content {
|
||||
New-UDTypography -Text 'Home' -Id 'homeText'
|
||||
} -Generated
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
$Navigation = @(
|
||||
New-UDListItem -Label 'Home' -Icon (New-UDIcon -Icon Home) -OnClick {
|
||||
Invoke-UDRedirect -Url '/home'
|
||||
}
|
||||
New-UDListItem -Label 'Users' -Icon (New-UDIcon -Icon User) -OnClick {
|
||||
Invoke-UDRedirect -Url '/users'
|
||||
}
|
||||
New-UDListItem -Label 'Groups' -Icon (New-UDIcon -Icon Users) -OnClick {
|
||||
Invoke-UDRedirect -Url '/groups'
|
||||
}
|
||||
)
|
||||
|
||||
New-UDApp -Title 'PowerShell Universal' -Pages @(
|
||||
Get-UDPage -Name 'home'
|
||||
Get-UDPage -Name 'users'
|
||||
Get-UDPage -Name 'groups'
|
||||
) -Navigation $Navigation
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Groups' -Content {
|
||||
New-UDTypography -Text 'Groups'
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Home' -Content {
|
||||
New-UDTypography -Text 'Home'
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
New-UDPage -Name 'Users' -Content {
|
||||
New-UDTypography -Text 'Users'
|
||||
}
|
||||
Reference in New Issue
Block a user