Proactive remediations of Deploying Sidecar Intune Managed Installer

#detect
[string]$SidecarMiPolicy = 
@"
<?xml version="1.0"?>
<AppLockerPolicy Version="1">
    <RuleCollection Type="Dll" EnforcementMode="AuditOnly">
        <FilePathRule Id="86f235ad-3f7b-4121-bc95-ea8bde3a5db5" Name="Dummy Rule" Description="" UserOrGroupSid="S-1-1-0" Action="Deny">
            <Conditions>
                <FilePathCondition Path="%OSDRIVE%\ThisWillBeBlocked.dll" />
            </Conditions>
        </FilePathRule>
        <RuleCollectionExtensions>
            <ThresholdExtensions>
                <Services EnforcementMode="Enabled" />
            </ThresholdExtensions>
            <RedstoneExtensions>
                <SystemApps Allow="Enabled" />
            </RedstoneExtensions>
        </RuleCollectionExtensions>
    </RuleCollection>

    <RuleCollection Type="Exe" EnforcementMode="AuditOnly">
        <FilePathRule Id="9420c496-046d-45ab-bd0e-455b2649e41e" Name="Dummy Rule" Description="" UserOrGroupSid="S-1-1-0" Action="Deny">
            <Conditions>
                <FilePathCondition Path="%OSDRIVE%\ThisWillBeBlocked.exe" />
            </Conditions>
        </FilePathRule>
        <RuleCollectionExtensions>
            <ThresholdExtensions>
                <Services EnforcementMode="Enabled" />
            </ThresholdExtensions>
            <RedstoneExtensions>
                <SystemApps Allow="Enabled" />
            </RedstoneExtensions>
        </RuleCollectionExtensions>
    </RuleCollection>

    <RuleCollection Type="ManagedInstaller" EnforcementMode="AuditOnly">
        <FilePublisherRule Id="3cf97403-1b4a-4492-8e70-98436cf78983" Name="MICROSOFT.MANAGEMENT.SERVICES.INTUNEWINDOWSAGENT.EXE version 1.37.200.8 exactly in MICROSOFT INTUNE from O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US" Description="2" UserOrGroupSid="S-1-1-0" Action="Allow">
            <Conditions>
                <FilePublisherCondition PublisherName="O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US" ProductName="*" BinaryName="MICROSOFT.MANAGEMENT.SERVICES.INTUNEWINDOWSAGENT.EXE">
                    <BinaryVersionRange LowSection="1.37.200.8" HighSection="*" />
                </FilePublisherCondition>
            </Conditions>
        </FilePublisherRule>
    </RuleCollection>
</AppLockerPolicy>
"@


function VerifyCompliance([xml]$MIPolicy)
{
    # Load the current effective AppLocker policy
    try
    {
        [xml]$effectivePolicyXml = Get-AppLockerPolicy -Effective -Xml -ErrorVariable ev -ErrorAction SilentlyContinue
    }
    catch
    {
        Write-Error('Get-AppLockerPolicy failed. ' + $_.Exception.Message)
        exit 1
    }

    [xml]$desiredPolicy = $MIPolicy
    $binaryName = $desiredPolicy.AppLockerPolicy.childnodes.FilePublisherRule.Conditions.FilePublisherCondition.BinaryName

    $miNode = $effectivePolicyXml.childnodes.RuleCollection.FilePublisherRule.Conditions.FilePublisherCondition | Where-Object {$_.Binaryname -eq $binaryName}
   
    if(-not $miNode)
    {
        Write-Host('Intune Managed Installer policy not installed')
        return $false
    }

    # New version?
    $currentVersion = $minode.ParentNode.ParentNode.Description
    $desiredversion = $desiredPolicy.AppLockerPolicy.childnodes.FilePublisherRule.Description

    if($desiredversion -ne $currentVersion)
    {
        Write-Host('Upgrade from version ' + $currentVersion + ' to ' + $desiredversion)
        return $false
    }
    else
    {
        Write-Host('Same version (' + $currentVersion + '), no need to install')
        return $true
    }
}


# Execution flow starts here


# Check if it contains MI policy and if the MI policy has rules for sidecar
try
{
    $compliant = VerifyCompliance($SidecarMiPolicy)
}
catch
{
    Write-Error('Failed to verify AppLocker policy compliance. ' + $_.Exception.Message)
    exit 1
}


if($compliant)
{
   # sidecar is set as the managed installer
   Write-Host("Sidecar is set as the managed installer.")

   # Check if the registry value is there and set it if it is not
   if(!(Get-ItemProperty -Path Registry::"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IntuneManagementExtension\SideCarPolicies" -Name "ManagedInstallerEnabled" -ErrorAction Ignore))
   {
      Write-Host("ManagedInstallerEnabled in registry is missing")
      Set-ItemProperty -Path Registry::"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IntuneManagementExtension\SideCarPolicies" -Name "ManagedInstallerEnabled" -Value 1
   }

   exit 0
}
else
{
   # sidecar is not set as the managed insatller
   Write-Host("Sidecar is not set as a managed installer.")

   # Check if the registry value is there and remove it if it is there
   if(Get-ItemProperty -Path Registry::"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IntuneManagementExtension\SideCarPolicies" -Name "ManagedInstallerEnabled" -ErrorAction Ignore)
   {
      Write-Host("ManagedInstallerEnabled should not be present")
      Remove-ItemProperty -Path Registry::"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IntuneManagementExtension\SideCarPolicies" -Name "ManagedInstallerEnabled"
   }

   exit 1
}
# SIG # Begin signature block
# MIIjlAYJKoZIhvcNAQcCoIIjhTCCI4ECAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBIa3nZl+z60Kgn
# myenV7gq9oD3MM8Y7fR2DEKmn1dePKCCDXYwggX0MIID3KADAgECAhMzAAAB3vl+
# gOdHKPWkAAAAAAHeMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD
# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy
# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p
# bmcgUENBIDIwMTEwHhcNMjAxMjE1MjEzMTQ0WhcNMjExMjAyMjEzMTQ0WjB0MQsw
# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u
# ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMR4wHAYDVQQDExVNaWNy
# b3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSq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yn28gO0Xm079
# z5EDMGmqEmP6mkefqgEK3wcxTqvAU5coh5VAuO7nUoNvi3VMsABzKeQv/9n/HWXf
# /c4hjvGVUKa5qHJOMTkcz8mlN7ffiqY0+md/vFBbq4mO3nYczjBPhg==
# SIG # End signature block
#Remediate
# Variables
[System.Int32]$waitBatchSeconds = 5
[System.Int32]$maxWaitSeconds = 300

# Applocker policy
[string]$SidecarMiPolicy = 
@"
<?xml version="1.0"?>
<AppLockerPolicy Version="1">
    <RuleCollection Type="Dll" EnforcementMode="AuditOnly">
        <FilePathRule Id="86f235ad-3f7b-4121-bc95-ea8bde3a5db5" Name="Dummy Rule" Description="" UserOrGroupSid="S-1-1-0" Action="Deny">
            <Conditions>
                <FilePathCondition Path="%OSDRIVE%\ThisWillBeBlocked.dll" />
            </Conditions>
        </FilePathRule>
        <RuleCollectionExtensions>
            <ThresholdExtensions>
                <Services EnforcementMode="Enabled" />
            </ThresholdExtensions>
            <RedstoneExtensions>
                <SystemApps Allow="Enabled" />
            </RedstoneExtensions>
        </RuleCollectionExtensions>
    </RuleCollection>

    <RuleCollection Type="Exe" EnforcementMode="AuditOnly">
        <FilePathRule Id="9420c496-046d-45ab-bd0e-455b2649e41e" Name="Dummy Rule" Description="" UserOrGroupSid="S-1-1-0" Action="Deny">
            <Conditions>
                <FilePathCondition Path="%OSDRIVE%\ThisWillBeBlocked.exe" />
            </Conditions>
        </FilePathRule>
        <RuleCollectionExtensions>
            <ThresholdExtensions>
                <Services EnforcementMode="Enabled" />
            </ThresholdExtensions>
            <RedstoneExtensions>
                <SystemApps Allow="Enabled" />
            </RedstoneExtensions>
        </RuleCollectionExtensions>
    </RuleCollection>

    <RuleCollection Type="ManagedInstaller" EnforcementMode="AuditOnly">
        <FilePublisherRule Id="3cf97403-1b4a-4492-8e70-98436cf78983" Name="MICROSOFT.MANAGEMENT.SERVICES.INTUNEWINDOWSAGENT.EXE version 1.37.200.8 exactly in MICROSOFT INTUNE from O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US" Description="2" UserOrGroupSid="S-1-1-0" Action="Allow">
            <Conditions>
                <FilePublisherCondition PublisherName="O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US" ProductName="*" BinaryName="MICROSOFT.MANAGEMENT.SERVICES.INTUNEWINDOWSAGENT.EXE">
                    <BinaryVersionRange LowSection="1.37.200.8" HighSection="*" />
                </FilePublisherCondition>
            </Conditions>
        </FilePublisherRule>
    </RuleCollection>
</AppLockerPolicy>
"@


function MergeAppLockerPolicy([string]$policyXml)
{
    $policyFile = '.\AppLockerPolicy.xml'
    $policyXml | Out-File $policyFile

    Write-Host "Merging and setting AppLocker policy"

    [System.Int32]$tryNum = 0
    [System.Int32]$failed = 0
    do{
        $failed = 0
        try {
            Set-AppLockerPolicy -XmlPolicy $policyFile -Merge -ErrorAction SilentlyContinue
        } catch {
            $failed = 1
            $tryNum= $tryNum + 1

            write-host("Failed " + $tryNum.ToString())

            $exception = $_.Exception
            write-host($exception.Message.ToString())

            Start-Sleep -s 30
        }

    } while(($tryNum -lt 6) -and ($failed -eq 1))

    if($failed -eq 1)
    {
       throw("MergeAppLockerPolicy failed 6 times")
    }

    Remove-Item $policyFile
}

function HandleUpgrade([string]$MIPolicy)
{
    # Load the current effective AppLocker policy
    try
    {
        [xml]$effectivePolicyXml = Get-AppLockerPolicy -Effective -Xml -ErrorVariable ev -ErrorAction SilentlyContinue
    }
    catch
    {
        Write-Error('Get-AppLockerPolicy failed. ' + $_.Exception.Message)
        exit 1
    }

    [xml]$desiredPolicy = $MIPolicy
    $binaryName = $desiredPolicy.AppLockerPolicy.childnodes.FilePublisherRule.Conditions.FilePublisherCondition.BinaryName

    $miNode = $effectivePolicyXml.childnodes.RuleCollection.FilePublisherRule.Conditions.FilePublisherCondition | Where-Object {$_.Binaryname -eq $binaryName}
   
    if(-not $miNode)
    {
        Write-Host('Policy does not contain a Intune managed installer')
        return
    }

    $currentVersion = $minode.ParentNode.ParentNode.Description
    $desiredversion = $desiredPolicy.AppLockerPolicy.childnodes.FilePublisherRule.Description

    if($desiredversion -ne $currentVersion)
    {
        Write-Host('Upgrade from version ' + $currentVersion + ' to ' + $desiredversion)

        # Need to upgrade / downgrade

        $IntuneMINode = $minode.ParentNode.ParentNode

        $TopMINode = $IntuneMINode.ParentNode

        Write-Host('Delete Intune MI section')

        $IntuneMINode.ParentNode.RemoveChild($IntuneMINode)

        if($TopMINode.ChildNodes.Count -eq 0)
        {
            Write-Host('Delete MI section')
            $TopMINode.ParentNode.RemoveChild($TopMINode)
        }

        $NewPolicyFile = '.\NewAppLockerPolicy.xml'
        $effectivePolicyXml.OuterXml | Out-File $NewpolicyFile

        Set-AppLockerPolicy -XmlPolicy $NewpolicyFile -ErrorAction SilentlyContinue

        Start-Sleep -s 15

        return
    }
    else
    {
        Write-Host('Same version (' + $currentVersion + '), no need to install')

        # Set ManagedInstallerEnabled to 1
        Set-ItemProperty -Path Registry::"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IntuneManagementExtension\SideCarPolicies" -Name "ManagedInstallerEnabled" -Value 1

        Write-Host ('Sidecar is set as the managed Installer.')
        exit 0
    }
}

#Start AppID Driver service
start-service "AppID"

#Start Application Identity service
start-service "AppIDSvc"

# Start Smartlocker and set it to auto start
$sevName = "applockerfltr"
start-service $sevName 
set-service -name $sevName -StartupType Automatic

# Check service state, wait up to 5 minute
[System.Int32]$waitedSeconds = 0
while($waitedSeconds -lt $maxWaitSeconds)
{
    Start-Sleep -Seconds $waitBatchSeconds
    $waitedSeconds += $waitBatchSeconds

    if(-not ((Get-Service AppIDSvc).Status -eq 'Running'))
    {
        Write-Host 'AppID Service is not fully started yet.'
        continue
    }

    if(-not ((Get-Service AppID).Status -eq 'Running'))
    {
        Write-Host 'AppId Driver Service is not fully started yet.'
        continue
    }

    if(-not ((Get-Service applockerfltr).Status -eq 'Running'))
    {
        Write-Host 'AppLocker Filter Driver Service is not fully started yet.'
        continue
    }

    break
}

if (-not ($waitedSeconds -lt $maxWaitSeconds))
{
    Write-Error 'Time-out on waiting for services to start.'
    exit 1
}

# handle upgrade
try
{
    HandleUpgrade($SidecarMiPolicy)
}
catch
{
    $e = $_.Exception
    Write-Error('Failed in handling upgrade. ' + $e.Message.ToString())
    exit 1
}


# Set the policy
try
{
    MergeAppLockerPolicy($SidecarMiPolicy)
}
catch
{
    $e = $_.Exception
    Write-Error('Failed to merge AppLocker policy. ' + $e.Message.ToString())
    if(-not($e.Message.Contains("already exists")))
    {
        exit 1
    }
}

# Set ManagedInstallerEnabled to 1
Set-ItemProperty -Path Registry::"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IntuneManagementExtension\SideCarPolicies" -Name "ManagedInstallerEnabled" -Value 1

Write-Host ('Sidecar is set as the managed Installer.')

exit 0
# SIG # Begin signature block
# MIIjlAYJKoZIhvcNAQcCoIIjhTCCI4ECAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCA6XgLjG/0dJlOe
# n47IUW89PpkDEufX1Aex9iWQRePQLKCCDXYwggX0MIID3KADAgECAhMzAAAB3vl+
# gOdHKPWkAAAAAAHeMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD
# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy
# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p
# bmcgUENBIDIwMTEwHhcNMjAxMjE1MjEzMTQ0WhcNMjExMjAyMjEzMTQ0WjB0MQsw
# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u
# ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0a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