manifests/collectors/Hybrid/VirtualMachines.psd1
|
# # GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Hybrid/VirtualMachines.ps1 (AB#5660). # Field expressions are copied verbatim from the original collector and evaluate in an # equivalent scope -- see docs/design/decisions/declarative-collectors.md. # Review before trusting; regenerate rather than hand-patch if the source collector changes. # @{ ResourceTypes = @( 'microsoft.azurestackhci/virtualmachineinstances' ) ResourceTypeMatching = 'Grouped' AdditionalFilter = $null FilterPreamble = '' RowLoopVariable = '1' Preamble = @' $ResUCount = 1 $sub1 = $SUB | Where-Object { $_.id -eq $1.subscriptionId } $data = $1.PROPERTIES $Tags = if (![string]::IsNullOrEmpty($1.tags.psobject.properties)) { $1.tags.psobject.properties } else { '0' } $Retired = $Retirements | Where-Object { $_.id -eq $1.id } if ($Retired) { $RetiredFeature = foreach ($Retire in $Retired) { $RetiredServiceID = $Unsupported | Where-Object { $_.Id -eq $Retired.ServiceID } [pscustomobject]@{ 'RetiredFeature' = $RetiredServiceID.RetiringFeature 'RetiredDate' = $RetiredServiceID.RetirementDate } } $RetiringFeature = if (@($RetiredFeature.RetiredFeature).count -gt 1) { $RetiredFeature.RetiredFeature | ForEach-Object { $_ + ' ,' } } else { $RetiredFeature.RetiredFeature } $RetiringFeature = [string]$RetiringFeature $RetiringFeature = if ($RetiringFeature -like '* ,*') { $RetiringFeature -replace ".$" } else { $RetiringFeature } $RetiringDate = if (@($RetiredFeature.RetiredDate).count -gt 1) { $RetiredFeature.RetiredDate | ForEach-Object { $_ + ' ,' } } else { $RetiredFeature.RetiredDate } $RetiringDate = [string]$RetiringDate $RetiringDate = if ($RetiringDate -like '* ,*') { $RetiringDate -replace ".$" } else { $RetiringDate } } else { $RetiringFeature = $null $RetiringDate = $null } # Hardware profile $VMSize = $data.hardwareProfile.vmSize $ProcessorCount = $data.hardwareProfile.processors $MemoryMB = $data.hardwareProfile.memoryMB # Dynamic memory $DynamicMemory = if ($data.hardwareProfile.dynamicMemoryConfig) { 'Enabled' } else { 'Disabled' } $DynMemMin = $data.hardwareProfile.dynamicMemoryConfig.minimumMemoryMB $DynMemMax = $data.hardwareProfile.dynamicMemoryConfig.maximumMemoryMB # OS profile $OSType = $data.osProfile.osType $ComputerName = $data.osProfile.computerName # Storage $DataDiskCount = if ($data.storageProfile.dataDisks) { @($data.storageProfile.dataDisks).Count } else { 0 } $ImageRef = if ($data.storageProfile.imageReference) { '{0}/{1}/{2}' -f $data.storageProfile.imageReference.publisher, $data.storageProfile.imageReference.offer, $data.storageProfile.imageReference.sku } else { $null } # Network interfaces $NICs = if ($data.networkProfile.networkInterfaces) { ($data.networkProfile.networkInterfaces | ForEach-Object { $_.id.split("/")[-1] }) -join ', ' } else { $null } # Status $PowerState = $data.instanceView.powerState $ProvisioningState = $data.provisioningState $StatusMsg = $data.status.provisioningStatus.status '@ AdditionalRowLoops = @() TagLoop = @{ Variable = 'Tag' Source = '$Tags' Preamble = '' } Fields = @( @{ Name = 'ID' Expression = '$1.id' } @{ Name = 'Subscription' Expression = '$sub1.name' } @{ Name = 'Resource Group' Expression = '$1.RESOURCEGROUP' } @{ Name = 'Name' Expression = '$1.NAME' } @{ Name = 'Location' Expression = '$1.LOCATION' } @{ Name = 'Retiring Feature' Expression = '$RetiringFeature' } @{ Name = 'Retiring Date' Expression = '$RetiringDate' } @{ Name = 'Power State' Expression = '$PowerState' } @{ Name = 'Provisioning State' Expression = '$ProvisioningState' } @{ Name = 'VM Size' Expression = '$VMSize' } @{ Name = 'OS Type' Expression = '$OSType' } @{ Name = 'Computer Name' Expression = '$ComputerName' } @{ Name = 'Processor Count' Expression = '$ProcessorCount' } @{ Name = 'Memory MB' Expression = '$MemoryMB' } @{ Name = 'Dynamic Memory' Expression = '$DynamicMemory' } @{ Name = 'Dynamic Mem Min MB' Expression = '$DynMemMin' } @{ Name = 'Dynamic Mem Max MB' Expression = '$DynMemMax' } @{ Name = 'Data Disk Count' Expression = '$DataDiskCount' } @{ Name = 'Image Reference' Expression = '$ImageRef' } @{ Name = 'Network Interfaces' Expression = '$NICs' } @{ Name = 'Status' Expression = '$StatusMsg' } @{ Name = 'Resource U' Expression = '$ResUCount' } @{ Name = 'Tag Name' Expression = '[string]$Tag.Name' } @{ Name = 'Tag Value' Expression = '[string]$Tag.Value' } ) Export = @{ WorksheetName = 'AzLocal VMs' TableNamePrefix = 'AzLocalVMs_' Columns = @( 'Subscription' 'Resource Group' 'Name' 'Location' 'Power State' 'Retiring Feature' 'Retiring Date' 'Provisioning State' 'VM Size' 'OS Type' 'Computer Name' 'Processor Count' 'Memory MB' 'Dynamic Memory' 'Dynamic Mem Min MB' 'Dynamic Mem Max MB' 'Data Disk Count' 'Image Reference' 'Network Interfaces' 'Status' 'Resource U' ) TagColumns = @( 'Tag Name' 'Tag Value' ) TagColumnsBefore = 'Resource U' NumberFormat = '0' ConditionalText = @( 'New-ConditionalText -Range F2:F100 -ConditionalType ContainsText' ) } SourceCollector = 'Modules/Public/InventoryModules/Hybrid/VirtualMachines.ps1' } |