In this very short post I will show how you get your uploaded Intune PowerShell scripts again. If you work with Intune and especially with Intune PowerShell scripts to configure Windows 10 devices you probably looked at this dialog and wondered why you are not able to edit or download your already uploaded script again.

During consulting work I often don’t have access to the original script files for review or modifications. This might be because there was no repository to maintain these uploaded scripts, or they got lost on the file server :-). Whatever the reason was for missing script files, this situation happens quite often. Also during migrations it can be handy to export scripts for re-import into another tenant.
I have written a small PowerShell script to download all the scripts to a specified folder again. In case you need an individual script it supports a FileName parameter to download just one specific PowerShell script.
The function uses the Intune PowerShell SDK:
It is super easy to use, just call it with the FolderPath parameter to download all PowerShell Scripts:
Get-DeviceManagementScripts -FolderPath C:\temp
Or you specify the FileName parameter to download the individual script:
Get-DeviceManagementScripts -FolderPath C:\temp -FileName HideFileExt.ps1
Your specified folder will give you access to all your scripts or just the individual one you specified:

The complete script can be found here:
https://github.com/okieselbach/Intune/blob/master/Get-DeviceManagementScripts.ps1
I hope it helps some people with lost original scripts or consultants without access to the original files. It can also be handy during tenant to tenant migrations.
Happy downloading!
Thanks Oliver, just needed it this week but had to use a ‘competitor’ script 🙂
that command doesnt exist in the 6.1907.1.0 (current version)
Oh really, I need to verify that and modify it to work again… give me some time to verify.
best,
Oliver
Did use this script just now which installed graph 6.1907.1.0, could use it without any issues. Nice for exporting PowerShell scripts for people who don’t use GitHub to store and version them 🙂
This is brilliant, works straight out of the box, thank you!
doesn’t work. If you want you’re scripts, try: https://pariswells.com/blog/intune/how-to-download-device-management-powershell-scripts-from-intune
That’s simply not true! I run it regularly and it is working fine. I verified it right now and it is working. I also know a bunch of people using it without issues. So, I think your issue is not resulting from the script. I don’t know what was not working for you. Also, you did not mention anything about the specific error you got. Just a complain about broken script. With a specific error, maybe the issue could be resolved for you. Anyway, the script is working fine.
Did exactly what your manual states, but the command isn’t working.
Get-DeviceManagementScripts : The term ‘Get-DeviceManagementScripts’ is not recognized as the name of a cmdlet,
If I use the: Show-Commend I get the GUI and only Get-DeviceAppManagement is showing.
What did I do wrong ?
Hi Zoet,
you have to run the script via .\Get-DeviceManagementScripts.ps1 or you comment the last lines where I execute the function Get-DeviceManagementScripts -FolderPath C:\temp with a # in the beginning and then you dot source the script via the command . C:\temp\Get-DeviceManagementScripts.ps1 Important the leading “.” this is the dot sourcing. This will “load the functions defined in the script” after that they are available in your PowerShell Session. Then you can call them via the function name and parameters e.g. Get-DeviceManagementScripts -FolderPath C:\temp -FileName myScript.ps1.
best,
Oliver
Not sure if the users having problems understand that you’ve actually published a separate script and they’re just assuming this is a cmdlet (included in the module Microsoft.Graph.Intune)
Oh, okay that might be… very valid point… thanks to mention it here! I didn’t thought of it like that.
Any way to expand this to other items, such as Shell Scripts for the MacOS side.
I have a shell script version in my GitHub 👍 have a look there.
If one tries to use different folder than c:\temp then output folder is empty… unless one changes the line 73 to a different path…
Awesome!
Took me a few minutes to realise it needs Windows Powershell rather than my default Powershell Core/7, but this really is useful.
Whoever decided at Microsoft not to include View/Edit functionality for uploaded scripts, have clearly missed the point of the cloud!
Thanks for tip of running it in Windows Powershell 👍
You are a genius – thank-you!
thanks for this, is there a way to get hold of Application install scripts that have been created (.ps1)
If you mean the install scripts within the .intunewin file, you need to install the app and follow this approach to get the necessary decryption information again: https://oliverkieselbach.com/2022/03/30/ime-debugging-and-intune-win32-app-decoding-part-2/ and finally able to decode it which reveals the app install scripts.
Thank you. I managed to retrieve all the scripts that were added by a previous IT admin.
Modify the script: Move the parameters to outside of the function. Rem out the parameter related lines in the function. Change the function call line to: Get-DeviceManagementScripts $FolderPath $FileName
Save the script.
Run in a PowerShell Admin CMD window: .\Get_DeviceManagementScripts -FolderPath Y:\Data\IntuneScripts\Scripts
(I renamed the .ps1 so I would not confuse it with the function.)
Works great.