Prevent Migration Agent uninstall when deployed from Intune
Learn how to prevent the uninstallation of Migration Agent when deploying it through Intune for greater security and stability.
If you are using Intune to push out the PowerSyncPro Migration Agent, then there is a possibility it could be uninstalled / removed during the execution of the migration agent part way through and your migration will fail to complete.
If the Intune App deployment is configured under assignments as “Required” - then when a device is de-registered from the Source Intune / Entra as part of a migration, the PowerSyncPro application will be uninstalled.
Intune Required App v Available for enrolled devices.
Please thoroughly end-to-end test your migration in advance of a production roll-out.
If this is likely to be an issue for then you can use a Pre-Migration command script to prevent this happening.
Create a ps1 file with the following code:
$PSPUninstallItems = @(Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall | ? { $_.GetValue('displayName') -eq 'PowerSyncPro Migration Agent' } )
$ManagedApplications = @(Get-ChildItem HKLM:\SOFTWARE\Microsoft\EnterpriseDesktopAppManagement -Recurse)
Foreach( $PSPUninstallItem in $PSPUninstallItems ) {
$ManagedPSPApplications = @($ManagedApplications | ? { $_.GetValue('ProductCode') -eq $PSPUninstallItem.PSChildName })
foreach( $ManagedPSPApplication in $ManagedPSPApplications ) {
Remove-Item $ManagedPSPApplication.PSPath -Recurse -Force
}
}
Save it as BlockIntuneUninstallofPSP.ps1
Create a cmdline.cmd file with the following code:
start /WAIT PowerShell.exe -ExecutionPolicy Unrestricted -File .\BlockIntuneUninstallofPSP.ps1
Add both files into a zip file and call it BlockIntuneUninstallofPSP.zip
Add this to the Start-Up tab of your Runbook
This will prevent the uninstall of PowerSyncPro deployed from Intune by updating the Registry Keys.