Get Back or Retrieve Intune PowerShell Scripts

In this blog post, we will see the steps to retrieve PowerShell script files uploaded to Intune admin center. Once you create the script deployment on Intune, there is no option to download the script directly from Intune admin center.

PowerShell Script Retrieval Use Case

A situation may arise where you have lost access to the script and no longer have it. This could result from permanently deleting the script from your storage or not knowing where the script is stored. If it’s an important code that you want to retrieve it and Intune script deployment for that script is still existing, then you can get back the script file.

PowerShell Script Download Location on Target Devices

You can deploy PowerShell script to end-user devices using Intune by navigating to Intune admin center > Devices > Scripts and remediations > Platform scripts. PowerShell script is downloaded at the following location on the target device: C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts. After the script execution is completed, it is automatically deleted, so it’s common to find this folder empty.

Retrieve PowerShell Script files

Now that we’ve identified the location where Intune downloads PowerShell scripts on target computers before execution, let’s proceed with the steps to retrieve the script files. It’s important to note that this process assumes the PowerShell script deployment still exists in the Intune admin center.

  1. Deploy the PowerShell script via Intune to any test device (it is recommended to deploy it on a device where it has never been deployed before)
  2. Monitor the C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts location.
  3. Be quick to copy the script and paste it into another folder before it gets automatically deleted by the Intune Management Extension.

Leave a Comment