PowerShell in Intune - Proactive Remediation Scripts (3/3)

Описание к видео PowerShell in Intune - Proactive Remediation Scripts (3/3)

This is the last video of a series of three, and here we go through an extremely useful Intune feature called Proactive Remediation.
To see the whole series check here:    • Intune - Three ways of using PowerShe...  
We will create two PowerShell scripts, one Detection script to detect a state and if we don't get the desired state we can ask the Detection script to call for the Remediation Script which will fix the desired state.
In this example, we want to uninstall all Mozilla Firefox of version 104 or older, but we could have done virtually anything.

Detection Proactive Remediation Script:
Detection script to find Mozilla Firefox versions older than 104
Author: John Bryntze
Date: 21st October 2022


if(test-path -Path 'C:\Program Files\Mozilla Firefox\firefox.exe')
{
check Firefox installed version
if((Get-Item -Path 'C:\Program Files\Mozilla Firefox\firefox.exe').VersionInfo.FileVersion -lt 104)
{
Write-Output "OLD: Firefox is older than version 104"
exit 1
}
else
{
Write-Output "Good: Firefox is of valid version"
exit 0
}
}
else
{
Write-Output "Good: No firefox installed"
exit 0
}

Remediation Proactive Remediation Script:
Remediation script to remove Mozilla Firefox
Author: John Bryntze
Date: 21st October 2022

Remove Mozilla Firefox
Start-process -FilePath 'C:\Program Files\Mozilla Firefox\uninstall\helper.exe' -ArgumentList "/S" -Wait

Комментарии

Информация по комментариям в разработке