Public/Com/Get-MyDefaultAUService.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<#
.SYNOPSIS
Returns the Default AU Service from Microsoft.Update.ServiceManager
 
.DESCRIPTION
Returns the Default AU Service from Microsoft.Update.ServiceManager
 
.LINK
https://osd.osdeploy.com/module/functions/getmy
 
.LINK
https://twitter.com/byteben/status/1356893619811155968
 
.NOTES
21.2.3 Initial Release
        Credit Ben Whitmore | byteben.com | @byteben
21.2.9 Removed unnecessary Brief parameter
        Modified command
         
#>

function Get-MyDefaultAUService {
    [CmdletBinding()]
    param ()

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