Get Back or Retrieve Intune PowerShell Scripts

In this blog post, we will see the steps to retrieve powershell script files uploaded on 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 its 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.

Conclusion

We have discussed about retrieving powershell script files uploaded on Intune admin center. This requires an already existing script deployment which can be used to get the script files.

Read Next

Leave a Comment