Azure – Optimize PowerShell code to avoid calling the cmdlet multiple times inside calculated properties?
I am looking to optimize the code below to avoid calling the same command twice under the calculated properties. https://learn.microsoft.com/en-us/powershell/module/az.compute/get-azvm https://learn.microsoft.com/en-us/powershell/module/az.compute/get-azvmsize Get-AzVM | Select-Object-Object Name, @{ l = 'osdiskingb'; e = { ($_.StorageProfile.OsDisk.DiskSizeGB) } }, ` @{ l = 'memory';…