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.
Intune App deployment
If the Intune App deployment is configured under assignments as “Required” - then when a device is de-registered/deleted/removed from the source tenant Intune as part of a migration, then the PowerSyncPro application will be uninstalled.
Intune Required App v Available for enrolled devices.

Testing
Please thoroughly end-to-end test your migration in advance of a production roll-out with test machines, early adopters, pilot users.
If this is likely to be an issue for then you can use a Pre-Migration command script to prevent this happening.
STEPS
Step 1
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
Step 2
Create a cmdline.cmd file with the following code:
start "" /WAIT PowerShell.exe -ExecutionPolicy Unrestricted -File .\BlockIntuneUninstallofPSP.ps1
Step 3
Add both files into a zip file and call it BlockIntuneUninstallofPSP.zip

Step 4
Add this to the Start-Up tab of your Runbook


This will prevent the uninstall of PowerSyncPro deployed from Intune, by updating the relevant Registry Keys.