skip to Main Content

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';…

VIEW QUESTION

Azure – Powershell Function -WhatIf for cmdlet without the -WhatIf support?

For these cmdlets below, I try to create the function with the [CmdletBinding(SupportsShouldProcess)] line, but not sure that it will work. Using: https://learn.microsoft.com/en-us/powershell/module/msonline/set-msoluserlicense?view=azureadps-1.0 How can the script be modified to support the -WhatIf parameter? function Remove-License { [CmdletBinding(SupportsShouldProcess)] param ([String]…

VIEW QUESTION
Back To Top
Search