PowerShell proactive remediation scripts for detecting and removing Lenovo AI Now from Intune-managed Windows devices.
| File | Purpose |
|---|---|
detect.ps1 |
Detects Lenovo AI Now traces and exits 1 when remediation should run. |
remediate.ps1 |
Removes Lenovo AI Now components, including locked shell-extension files that require reboot-time deletion. |
detect.ps1 re-launches itself in native 64-bit Windows PowerShell when Intune starts it in a 32-bit host. It checks:
- 32-bit and 64-bit uninstall registry entries.
- Common install directories under
C:\Program Files,C:\Program Files (x86), andC:\ProgramData. - Known Lenovo AI Now executable names, running processes, and services.
- Installed and provisioned AppX/MSIX packages.
- Orphaned AppX repository stubs under loaded user hives and HKLM AppX store keys.
Detection exits:
1when Lenovo AI Now is detected and remediation should run.0when no remediation is needed.0while a fresh remediation sentinel and LenovoPendingFileRenameOperationsentries exist, which prevents repeat remediation loops while the device is waiting for a reboot.
remediate.ps1 also re-launches itself in native 64-bit Windows PowerShell. It performs manual cleanup because the vendor uninstall path is not reliable in SYSTEM context.
The remediation flow:
- Attempt Lenovo's vendor uninstaller with the current typoed silent switch:
SlientUninstall. - Stop and disable Lenovo AI Now services.
- Stop Lenovo AI Now processes by install path and executable name.
- Remove installed and provisioned AppX/MSIX packages.
- Scrub orphaned AppX repository stubs.
- Unregister known and discovered Lenovo AI Now shell extensions.
- Remove user data, shortcuts, scheduled tasks, registry keys, and Run values.
- Remove install directories in-session when possible.
- Rename remaining files to
*.tobedeleted, queue locked files and directories inPendingFileRenameOperations, and write a Phase A sentinel when a reboot is required.
The vendor uninstall is best-effort only. Validation against Lenovo AI Now 1.3.3.912 showed SlientUninstall removes the app, uninstall entry, install directory, and AppX package, but can leave shell/COM registry traces behind. The script continues the manual cleanup path so those leftovers are still removed.
Locked shell-extension DLLs such as AINppShell.dll and OverlayIcon.dll are expected on active desktops. The script queues those files for boot-time deletion instead of killing Explorer or attempting long-running deletion workarounds.
The remediation log records the internal result:
0: Complete success.3010: Cleanup succeeded, reboot required to finish file deletion.1603: Partial failure; residual components remain and could not be queued for reboot deletion.1: Unhandled remediation error.
For Intune compatibility, 3010 is reported to Intune as process exit 0. Check the log for the actual remediation result.
Remediation writes to:
C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\Lenovo_AI_Now_Remediate.log
The detection script writes status to script output, which Intune captures in the remediation run details.
- Run under SYSTEM context.
- Set Run script as 32-bit process on 64-bit clients to No when possible.
- The scripts include a 64-bit relaunch guard, but using the 64-bit host directly avoids an extra process hop.
Test on a pilot device before broad deployment:
- Run
detect.ps1; expect1when Lenovo AI Now is present. - Run
remediate.ps1; expect Intune-compatible exit0. - Run
detect.ps1again; expect0if cleanup completed or reboot-time cleanup is queued. - Reboot if the remediation log records internal result
3010. - Run
detect.ps1again; expect0with no Lenovo AI Now traces.