Vm list in AzureUpdateManagement for "Not assessed" VM through Powershell

Azuretech 90 Reputation points
2023-04-19T10:12:34.33+00:00

We are using automation to patch multiple VMS using azureUpdateManagement (powershell based scripts) . I want to know how to get the VM name which are disconnected and showing" Not assessed" in UpdateManagement though Powershell,even though it's added in updateManagement. I want to use this VM name list in order to remove it from the patch schedule as it gives error if any of the VM is "not connected/not assessed" in a deploymnet schedule.

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,058 questions
Azure Update Manager
Azure Update Manager
An Azure service to centrally manages updates and compliance at scale.
219 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 43,941 Reputation points
    2023-04-20T15:29:47.52+00:00
    
    Hello there,
    
    If you are talking about network adapters that are "not connected", you can use something like:
    
    Get-VM | ?{$_.PowerState -eq "PoweredOn"} | %{
        $strVMName = $_.Name; Get-NetworkAdapter -VM $_ | `
            select @{n="VMName"; e={$strVMName}},Name,NetworkName,ConnectionState
    } | ?{$_.ConnectionState.Connected -eq $false}
    
    That gets all powered on VMs, gets their network adapters, and returns info about ones whose ConnectionState.Connected property is $false.  
    
    Hope this resolves your Query !!
    
    --If the reply is helpful, please Upvote and Accept it as an answer--