Query a Specific service Value through Powershell

Hari Bylapudi 21 Reputation points
2022-08-26T04:00:48.447+00:00

I Need help with the below PowerShell command to query the value of Windows Update "IsDefaultAUService"

PS C:\Users\Administrator> $(New-Object -ComObject "Microsoft.Update.ServiceManager").Services
Output of this command

Name : Microsoft Update
ContentValidationCert : {}
ExpirationDate :
IsManaged : False
IsRegisteredWithAU : True
IssueDate : 1/1/1601 12:00:00 AM
OffersWindowsUpdates : True
RedirectUrls : System.__ComObject
ServiceID : 7971f918-a847-4430-9279-4a52d1efe18d
IsScanPackageService : False
CanRegisterWithAU : True
ServiceUrl : https://fe2cr.update.microsoft.com/v6/
SetupPrefix : mu
IsDefaultAUService : True

Name : DCat Flighting Prod
ContentValidationCert : {}
ExpirationDate :
IsManaged : False
IsRegisteredWithAU : False
IssueDate : 1/1/1601 12:00:00 AM
OffersWindowsUpdates : True
RedirectUrls : System.__ComObject
ServiceID : 8b24b027-1dee-babb-9a95-3517dfb9c552
IsScanPackageService : False
CanRegisterWithAU : False
ServiceUrl : https://fe3cr.delivery.mp.microsoft.com/
SetupPrefix : wu
IsDefaultAUService : False

Name : Windows Store (DCat Prod)
ContentValidationCert : {}
ExpirationDate :
IsManaged : False
IsRegisteredWithAU : False
IssueDate : 1/1/1601 12:00:00 AM
OffersWindowsUpdates : False
RedirectUrls : System.__ComObject
ServiceID : 855e8a7c-ecb4-4ca3-b045-1dfa50104289
IsScanPackageService : False
CanRegisterWithAU : True
ServiceUrl : https://fe3cr.delivery.mp.microsoft.com/
SetupPrefix : ws
IsDefaultAUService : False

Name : Windows Update
ContentValidationCert : {}
ExpirationDate :
IsManaged : False
IsRegisteredWithAU : False
IssueDate : 1/1/1601 12:00:00 AM
OffersWindowsUpdates : True
RedirectUrls : System.__ComObject
ServiceID : 9482f4b4-e343-43b6-b170-9a65bc822c77
IsScanPackageService : False
CanRegisterWithAU : True
ServiceUrl : https://fe2cr.update.microsoft.com/v6/
SetupPrefix : wu
IsDefaultAUService : False

I need help with a PowerShell command to only provide me with the value of "IsDefaultAUService" of this service from above Output "Name= Windows Update"

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,549 questions
0 comments No comments
{count} votes

Accepted answer
  1. DaveK 1,861 Reputation points
    2022-08-26T11:15:42.917+00:00

    Hi, this should hopefully give you what your after:

    ((New-Object -ComObject "Microsoft.Update.ServiceManager").Services | Where {$_.Name -eq 'Windows Update'}).IsDefaultAUService  
    

    Cheers

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Christian Eriksson private 0 Reputation points
    2024-06-01T11:28:34.97+00:00

    Is there a corresponding CIM (WIM) object also?

    rgds Christian

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.