Get Back or Retrieve your Intune PowerShell Scripts

In this article, we will show you how to retrieve your Intune PowerShell scripts. You can get your PowerShell scripts deployed via Intune back in case the original scripts are accidentally deleted.


In our previous guide, we covered the steps to deploy PowerShell scripts using Intune. You can use the Microsoft Intune management extension to upload PowerShell scripts to Intune and then assign the scripts to Windows 10 and Windows 11 devices. For example, you can use PowerShell script to deploy fonts on Windows devices.


In the Intune admin center, when you upload a PowerShell script for deployment, you cannot download it back. Frankly speaking, the Intune admin center doesn’t provide an option to download the PowerShell scripts once they have been uploaded. But what if you need to get this original PS script back? The good news is that you can download all of your device management PowerShell scripts from Intune using multiple methods. Let’s see how.

https://themastergames.com/mybb/thread-larsa-4d-8-00

https://angelelite.de/showthread.php?tid=2568

https://forum.l2endless.com/showthread.php?tid=9667

https://forum.mbprinteddroids.com/showthread.php?tid=304&pid=380#pid380

https://www.zonaseputarslot.com/showthread.php?tid=807

Also See: How to Run Shell Scripts on macOS devices in Intune


The need to get back your Intune PowerShell scripts

Let us say that you or a team member have uploaded some crucial PowerShell scripts to Intune for deployment from your PC. The uploaded scripts are now deleted from your local computer, assuming they are no longer needed in the future. What if you need the scripts to import them to another tenant, and they have been deleted? How do you get them back from Intune?


The scenario that we described above is common in most organizations that use Intune to distribute PowerShell scripts to Windows devices. The assigned scripts are not documented, which causes additional issues when you require them back. When you have multiple Intune admins working on PowerShell script deployment, chances are that a PowerShell script may be accidentally deleted from the laptop.


Also Read: Deploy Fonts using Intune: 3 Proven Methods


Ways to retrieve PowerShell Scripts Deployed via Intune


There are two ways to get back your PowerShell scripts that you have deployed in Intune:

https://www.mircalemi.net/showthread.php?tid=1818

https://forum.21up.co.uk/showthread.php?tid=9

https://sportsreptile.site/thread-12989.html

https://forum.haustor.eu/showthread.php?tid=36

https://tictactech.net/forum/showthread.php?tid=107&pid=182#pid182

Download uploaded Intune PowerShell Scripts using Microsoft Graph

Use a PowerShell script to retrieve the uploaded scripts to Intune

We believe that, of the two methods described above, using a PowerShell script can help you easily retrieve all of your uploaded scripts to Intune. Using Microsoft Graph to retrieve your Intune PowerShell scripts requires expertise, and it’s a complex method as compared to using a script.


Location of PowerShell Scripts in Intune

The PowerShell scripts that you have uploaded to Intune can be located using the following steps:


Sign in to the Microsoft Intune Admin Center.

Select Devices > Windows > Scripts.

Switch to the Platform Scripts tab to find all the uploaded PowerShell scripts in Intune.



Location of PowerShell Scripts in Intune

Location of PowerShell Scripts in Intune

Location of Intune PowerShell Scripts on Target Devices

When you deploy PowerShell scripts to your Windows devices using Intune, the scripts are downloaded to the following location: C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts.


Remember that after the PowerShell scripts are downloaded to the target devices, you need to be quick to retrieve them. That’s because the PowerShell scripts stay in this location for a very short time. Once the PS deployment is complete, the Intune management extension deletes those scripts.

https://foro.muelendhir.com/showthread.php?tid=7153

https://www.carpentryforums.com/showthread.php?tid=4357&pid=9790#pid9790

https://forum.goddesszex.dev/showthread.php?tid=7864

http://www.xcosmic.net/rsf/showthread.php?tid=204

https://forum.ordcom.fr/showthread.php?tid=281

Location of Intune PowerShell Scripts on Target Devices

Location of Intune PowerShell Scripts on Target Devices

Retrieve your Intune PowerShell Scripts

In this step, we will show you how to retrieve your Intune PowerShell scripts. To achieve this, we will use the Get-DeviceManagementScripts.ps1 script written by my friend Oliver Kieselbach, who is an Enterprise Mobility MVP. We thank him for this fantastic script, which allows many Intune administrators and consultants to retrieve PowerShell scripts from Intune.


Note: There are numerous scripts available on GitHub that can help retrieve PowerShell scripts deployed via Intune. We have tested several scripts and found Oliver Kieselbach’s PS script worked flawlessly.


Step 1: Download Get-DeviceManagementScripts.ps1 from GitHub

http://a123.woobi.co.kr/thread-112.html

https://www.forum.vuwpgsa.ac.nz/viewtopic.php?t=12954

https://www.forum.vuwpgsa.ac.nz/viewtopic.php?t=67399

https://www.forum.vuwpgsa.ac.nz/viewtopic.php?t=53621

https://www.forum.vuwpgsa.ac.nz/viewtopic.php?t=3807

The Get-DeviceManagementScripts.ps1 gets your uploaded Intune PowerShell scripts downloaded to a folder. The script is straightforward to use, and it downloads the uploaded scripts from Intune to a folder on your device. Use the following link to download Get-DeviceManagementScripts.ps1 from GitHub.


download Get-DeviceManagementScripts.ps1 from GitHub

download Get-DeviceManagementScripts.ps1 from GitHub

Step 2: Run the Get-DeviceManagementScripts PowerShell Script

https://forum.matfyzak.cz/viewtopic.php?t=29767

https://forum.matfyzak.cz/viewtopic.php?t=29603

https://forum.matfyzak.cz/viewtopic.php?t=29597

The Get-DeviceManagementScripts cmdlet downloads all or individual PowerShell scripts from Intune to a specified folder. To run this script, launch PowerShell as an administrator. Change the path to the location of the script, and now call the PS script.


When you run Get-DeviceManagementScripts.ps1, it uses the Intune PowerShell SDK, which provides support for the Intune API through Microsoft Graph. You’ll have to authenticate with an account to retrieve your Intune PowerShell scripts.

https://pkclan.net/viewtopic.php?p=65064

https://pkclan.net/viewtopic.php?p=65061

https://pkclan.net/viewtopic.php?p=65075

https://pkclan.net/viewtopic.php?p=56682

https://forum.matfyzak.cz/viewtopic.php?t=4386

Run the Get-DeviceManagementScripts - get back your Intune PowerShell Scripts

Run the Get-DeviceManagementScripts – get back your Intune PowerShell Scripts

The above script runs and downloads all the PowerShell scripts from Intune and saves them to the C:\Temp folder. All the PowerShell scripts that were previously uploaded to Intune were successfully retrieved, as shown in the screenshot below.


Retrieve your Intune PowerShell Scripts

Retrieve your Intune PowerShell Scripts

The Get-DeviceManagementScripts script offers two options for you: you can run the script to get all your Intune PowerShell scripts to a specific folder or download an individual PowerShell script to the specified folder.


Run the following command to retrieve your Intune PowerShell scripts to the specified folder:


Get-DeviceManagementScripts -FolderPath C:\temp

Run the below PS command to download an individual PowerShell script to the specified folder. If you are using this command, you must enter the name of the script that you want to download.

Comments

Popular posts from this blog

8 Ways to Fix Windows Update Error 0x80070643

Hotfix Rollup KB25858444 for SCCM 2309: 8 Critical Fixes

How to Customize the App Store in Microsoft Teams