update
This commit is contained in:
+10
-9
@@ -82,6 +82,8 @@ switch ($PSCmdlet.ParameterSetName) {
|
|||||||
|
|
||||||
$FqdnFromSCTaskDescription = ($SCTask.short_description).display_value.split(' ')[7]
|
$FqdnFromSCTaskDescription = ($SCTask.short_description).display_value.split(' ')[7]
|
||||||
|
|
||||||
|
$AvailabilityZone =
|
||||||
|
|
||||||
$NewITDWindowsVmAzureParams = @{
|
$NewITDWindowsVmAzureParams = @{
|
||||||
FQDN = ( ($Ritm.VariableSet | Where-Object { $_.host_name -eq $FqdnFromSCTaskDescription }).host_name );
|
FQDN = ( ($Ritm.VariableSet | Where-Object { $_.host_name -eq $FqdnFromSCTaskDescription }).host_name );
|
||||||
VmSize = ( ($Ritm.VariableSet | Where-Object { $_.host_name -eq $FqdnFromSCTaskDescription }).azure_vm_size );
|
VmSize = ( ($Ritm.VariableSet | Where-Object { $_.host_name -eq $FqdnFromSCTaskDescription }).azure_vm_size );
|
||||||
@@ -92,24 +94,23 @@ switch ($PSCmdlet.ParameterSetName) {
|
|||||||
VMEnvironment = ( $Ritm.customvariable.environment.value );
|
VMEnvironment = ( $Ritm.customvariable.environment.value );
|
||||||
AppName = ( Get-ITDServiceNowRecord -Table 'cmdb_ci_service' -SysId ($Ritm.VariableSet | Where-Object { $_.host_name -eq "$FqdnFromSCTaskDescription" }).application_info).name.display_value;
|
AppName = ( Get-ITDServiceNowRecord -Table 'cmdb_ci_service' -SysId ($Ritm.VariableSet | Where-Object { $_.host_name -eq "$FqdnFromSCTaskDescription" }).application_info).name.display_value;
|
||||||
LicensingRestrictions = ( ($Ritm.VariableSet | Where-Object { $_.host_name -eq $FqdnFromSCTaskDescription }).licensing_restrictions );
|
LicensingRestrictions = ( ($Ritm.VariableSet | Where-Object { $_.host_name -eq $FqdnFromSCTaskDescription }).licensing_restrictions );
|
||||||
AvailabilityZone = ( switch( ($Ritm.VariableSet | Where-Object { $_.host_name -eq $FqdnFromSCTaskDescription }).zone ) {
|
|
||||||
'1' { 'Zone 1' }
|
|
||||||
'2' { 'Zone 2' }
|
|
||||||
'3' { 'Zone 3' }
|
|
||||||
Default { 'No Zone' }
|
|
||||||
}
|
}
|
||||||
)
|
|
||||||
});
|
switch ( ($Ritm.VariableSet | Where-Object { $_.host_name -eq $FqdnFromSCTaskDescription }).zone ) {
|
||||||
|
'Zone 1' { $NewITDWindowsVMAzureParams += @{ AvailabilityZone = 1 } }
|
||||||
|
'Zone 2' { $NewITDWindowsVMAzureParams += @{ AvailabilityZone = 2 } }
|
||||||
|
'Zone 3' { $NewITDWindowsVMAzureParams += @{ AvailabilityZone = 3 } }
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($PSBoundParameters.Keys) {
|
switch ($PSBoundParameters.Keys) {
|
||||||
'ResourceGroupNameOverride' {
|
'ResourceGroupNameOverride' {
|
||||||
Write-Warning -Message "ResourceGroupNameOverride found $ResourceGroupNameOverride"
|
Write-Warning -Message "ResourceGroupNameOverride found $ResourceGroupNameOverride"
|
||||||
$NewITDWindowsVMAzureParams += @{ ResourceGroupNameOverride = $ResourceGroupNameOverride }
|
$NewITDWindowsVMAzureParams += @{ ResourceGroupNameOverride = $ResourceGroupNameOverride }
|
||||||
}
|
}
|
||||||
'AvailabilityZone' {
|
<#'AvailabilityZone' {
|
||||||
Write-Warning -Message "ResourceGroupNameOverride found $AvailabilityZone"
|
Write-Warning -Message "ResourceGroupNameOverride found $AvailabilityZone"
|
||||||
$NewITDWindowsVMAzureParams += @{ AvailabilityZone = $AvailabilityZone }
|
$NewITDWindowsVMAzureParams += @{ AvailabilityZone = $AvailabilityZone }
|
||||||
}
|
}#>
|
||||||
<# 'VMSizeOverride' {
|
<# 'VMSizeOverride' {
|
||||||
Write-Warning -Message "VMSizeOverride found $VMSizeOverride"
|
Write-Warning -Message "VMSizeOverride found $VMSizeOverride"
|
||||||
$NewITDWindowsVMAzureParams += @{ VMSizeOverride = $VMSizeOverride }
|
$NewITDWindowsVMAzureParams += @{ VMSizeOverride = $VMSizeOverride }
|
||||||
|
|||||||
+37
-1
@@ -213,7 +213,7 @@ $Results = foreach ($VM in $AllVMs) {
|
|||||||
|
|
||||||
# --- vCenter Tags
|
# --- vCenter Tags
|
||||||
Tag_DRProtection = $VMTags['DR Protection']
|
Tag_DRProtection = $VMTags['DR Protection']
|
||||||
Tag_AppName = $VMTags['AppName']
|
Tag_AppName = if ($null -ne $VMTags['AppName']) { $VMTags['AppName'] } else { 'N/A' }
|
||||||
Tag_VRDatastores = $VMTags['VR Datastores']
|
Tag_VRDatastores = $VMTags['VR Datastores']
|
||||||
Tag_VRRPO = $VMTags['VR RPO']
|
Tag_VRRPO = $VMTags['VR RPO']
|
||||||
Tag_DTAP = $VMTags['DTAP']
|
Tag_DTAP = $VMTags['DTAP']
|
||||||
@@ -223,6 +223,42 @@ $Results = foreach ($VM in $AllVMs) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region --- Back-fill SRM placeholder fields from real VM ----------------------
|
||||||
|
# SRM placeholder VMs share the same name as their real counterpart but lack
|
||||||
|
# guest-level data. For the fields below, substitute the real VM's values so
|
||||||
|
# placeholders carry useful metadata for reporting.
|
||||||
|
|
||||||
|
$RealVMLookup = @{}
|
||||||
|
foreach ($R in $Results) {
|
||||||
|
if (-not $R.IsSRMPlaceholder) { $RealVMLookup[$R.VMName] = $R }
|
||||||
|
}
|
||||||
|
|
||||||
|
$PlaceholderFieldsToFix = @(
|
||||||
|
'GuestOS'
|
||||||
|
'ProvisionedSpaceGB'
|
||||||
|
'UsedSpaceGB'
|
||||||
|
'GuestDiskCapacityGB'
|
||||||
|
'GuestDiskUsedGB'
|
||||||
|
'ToolsVersionStatus'
|
||||||
|
'Tag_DRProtection'
|
||||||
|
'Tag_AppName'
|
||||||
|
'Tag_VRDatastores'
|
||||||
|
'Tag_VRRPO'
|
||||||
|
'Tag_DTAP'
|
||||||
|
'Tag_StartupPriority'
|
||||||
|
'Tag_SRMRecoveryType'
|
||||||
|
'Tag_LicensingRestrictions'
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach ($R in $Results) {
|
||||||
|
if ($R.IsSRMPlaceholder -and $RealVMLookup.ContainsKey($R.VMName)) {
|
||||||
|
$Real = $RealVMLookup[$R.VMName]
|
||||||
|
foreach ($Field in $PlaceholderFieldsToFix) { $R.$Field = $Real.$Field }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
<#region --- Export CSV ---------------------------------------------------------
|
<#region --- Export CSV ---------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user