ee if a template is installed so that it 
# can be unregistered
#
# Script Type: PowerShell
# Script Action: Unregister
# Script Version: 1
# UE-V Template Version: %%UEVTEMPLATEVERSION%%

Set-StrictMode -Version latest

Set-Variable -name COMPLIANT_CODE -value 1 -option constant
Set-Variable -name NOT_COMPLIANT_CODE -value 0 -option constant

$result = $NOT_COMPLIANT_CODE
    
try
{
    $templateObj = [wmi] 'root\Microsoft\UEV:SettingsLocationTemplate="%%UEVTEMPLATEID%%"'
    $template = $templateObj.GetContent().ReturnValue

    if ($template.Length -eq 0)
    {
        $result = $COMPLIANT_CODE
    }
}
catch
{
    $result = $COMPLIANT_CODE
}
    
Write-Output $result
