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.
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!