It looks like getting back all the script content in Intune is of high interest 😉, soon after I published how to get back your Proactive Remediation Scripts, I got another request for the Intune Win32 Application scripts (Detection and Requirement scripts).

So here we go, another small script to get back all the Win32 application scripts. To be precise, there can be several Requirements scripts attached to a Win32 application:

But only one Detection script can be there:

As explained already, I decided to code it in a similar way like the other scripts I already published:
The function uses the Intune PowerShell SDK like the other scripts:
The script is super easy to use, just call it with the FolderPath parameter to download all Win32 App Scripts:
Get-Win32AppScripts -FolderPath C:\Temp\Win32AppScripts
Or you specify in addition the AppId parameter to download the individual scripts for a single Win32 application:
Get-Win32AppScripts -FolderPath C:\Temp\Win32AppScripts -AppId 2cd64b95-dda3-4333-bcf1-6d9f3237ce73
Your specified folder will give you access to all your Win32 application scripts or just the individual one you specified. Organized by folders and the folder names are constructed from AppId_DisplayName:

The folders containing the scripts which were found:

The complete script can be found here:
https://github.com/okieselbach/Intune/blob/master/Get-Win32AppScripts.ps1
I guess we are now complete and have access to all the script content in Intune again. Again, 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!
HI
Hope all is well.
I tried this today and it failed, it tried downloading one and says unable and then doesnt go through all our scripts?
Oh sad to hear, I was successful in my environments. Which error do you get, then i can probably find the issue
Thank you for doing this.
I ran your script successfully and I got all of the scripts that I expected, but I noticed that contents of each DetectionScript.ps1 were altered to add a “?” character as the first character on the first line.
Is that to be expected? I was going to run each script to make sure the logic is sound, but the “?” invalidates it.
Thanks
Oh it might be an encoding issue. I write the files as utf8 to prevent such an issue but it might still went something wrong on your side. What is the file format of the exported script if you look at it in vs code for example?
How do I check the file format? I downloaded and installed VS Code, but I don’t see how to check the file format.
Thanks
On the lower right corner you will find something like UTF-8
It says UTF-8. All other contents of the script are fine. Its just that one added “?” character at the beginning.
Hey Oliver, thanks for the great guide!
Do you know how to get back install scripts from Win32 apps? Sometimes we publish powershell scripts as Win32 apps and I lost one of them.
Hi Rick,
Have looked at this, this method can decode packages https://oliverkieselbach.com/2019/01/03/how-to-decode-intune-win32-app-packages/
Best,
Oliver
Awesome! Thanks for the quick reply. I’ll look into it now.