Need help with an Azure Powershell script #22689
Unanswered
utkarshdemon
asked this question in
Q&A
Replies: 2 comments 4 replies
-
This is the starting point in the document using this example You'd need to get all vms in all subscriptions that you have access to which means that your end code could look like this $allSubscriptions = Get-AzSubscription
$hybridVMs = @()
foreach ($subscription in $allSubscriptions) {
Set-AzContext -Subscription $subscription.Id
$subscriptionVMs = Get-AzVM | Where-Object {
$_.LicenseType -eq "Windows_Server" -and
$_.StorageProfile.OsDisk.ImageSKU -like "*2012*"
}
$hybridVMs += $subscriptionVMs
}
$hybridVMs |
Beta Was this translation helpful? Give feedback.
3 replies
-
@kilasuit can you please add a line in which we can get the details all in a .csv file |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Need a count and names of Windows 2012 VMs using "Azure Hybrid Benefit for Windows" as "OS licensing benefit" type
Beta Was this translation helpful? Give feedback.
All reactions