73 lines
3.9 KiB
PowerShell
73 lines
3.9 KiB
PowerShell
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'
|
|
} |