Skip to content

PowerShell··1 min read

Test-TrustedPublishers

How to test to see if the trusted publsiher is configured to allow third party software updates to install/apply.

Test-TrustedPublishers

We frequently get asked questions about how to investigate if a machine has the proper settings enabled to trust third party software updates. You can of course go check lots of GPO settings, but ultimately it’s a registry setting. So here is a simple PowerShell function, and the key involved which you could use in any ‘Run Script’ or other solution.

The registry key you are looking for is:

HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AcceptTrustedPublisherCerts

If you want a function here you go:

Function Test-TrustedPublishers{
    [cmdletbinding()]
    param()
    $trustedPublisherValue = try{
        $res = (Get-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate -Name AcceptTrustedPublisherCerts -ErrorAction SilentlyContinue -ErrorVariable err).AcceptTrustedPublisherCerts
        if($err){
            throw
        }
        $res
    }
    Catch {
        Write-Error -Message "Could not find or access the key." -ErrorAction Stop
    }
    if($trustedPublisherValue -eq 1){
        Write-Output -InputObject $true
    }
    Else{
        return $false
    }
}
Test-TrustedPublishers

Want just a one liner instead, here you go:

(Get-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate -Name AcceptTrustedPublisherCerts -ErrorAction SilentlyContinue -ErrorVariable err).AcceptTrustedPublisherCerts

The result will return 1, 0 or error. If it’s a 1 it’s enabled, if it’s anything else then it’s not configured correctly.

Comments

Comments are GitHub Discussions, loaded on request.