Work more efficiently with Powershell scripts

Share This Post


In this blog post, I’ll go through how I created a relatively simple PowerShell script to automatically rename folders and files when I was experimenting with the deployment of Winget applications in Microsoft Intune. 

While experimenting with the deployment of applications using Winget through Intune, I found myself in a tiring situation where I manually had to edit the names of files and folders, and also create a new .intunewin-file every time I wanted to re-deploy an application with minor adjustments.  
Once the files and folders were renamed and edited I had to use the Microsoft Win32 Content Prep Tool / IntuneWinAppUtil.exe to create a file which I later uploaded to Intune.  

This process involves specifying a Source folder containing the scripts, a Source file, and an Output folder where the generated .intunewin-file will end up. 

Level up the process with Powershell & Winget

To save me some time doing this I created a PowerShell script that automates this process for me.  
Instead of editing the name of each file and folder, you have to enter a Winget App ID into the PowerShell console when running the script. 

How it works 

The script copies a template folder containing all files and subfolders necessary and replaces/renames all variables and documents inside. The new folder eventually ends up in the Apps folder. 

Once the folder and file creation is done, it triggers the IntuneWinAppUtil.exe and automatically generates the .intunewin file we need and puts it in the Output folder. 

As the script runs you can follow the progress in the console. 

After a successful run the folder structure looks like this: 

When the script has created all the files you need the next step is to upload them to Intune. 
During this process, the install commands found in Intune_Install_Cmds.txt will come in handy. 
A future blog post might cover how the actual deployment in Intune works.  Stay tuned!

If you are interested in the script, you can find it here:  
GitHub – yavanode/Public 
Read more about winget here: 

Use the winget tool to install and manage applications | Microsoft Learn 

If you need any help or guidance, don’t hesitate to reach out to us!

Fredrik Majava, IT Consultant at Agdiwo

Application Distribution

PowerShell is a versatile and powerful tool that can help boost productivity and streamline operations in your organization.  At Agdiwo, we are experts in powershell and much more. Our team can help you optimize your digital workplace with a full range of IT services, from strategic planning and analysis to implementation and training. Whether you’re looking to improve security, boost productivity, or streamline workflows, we have the expertise and experience to help you succeed. 

Optimize your digital workplace with our IT-experts!

More To Explore

Intune vs CM

Intune vs Configuration Manager

Which device management suits you? Digital transformation and mobility are shaping how we work right now, and IT managers are faced with crucial decisions regarding

Subscribe To Our Newsletter

Get updates and learn from Us