Here’s a PowerShell script to push to endpoints which will set 7-Zip as the default app to use to open up .zip files. You can use Intune to push the script out.
Manual setting of the file association can be performed within the 7-Zip app itself under the Tools\Options menu.
You can set the type association by clicking on the appropriate row and under the column to choose for your user or All users.
If you get an Access Denied, then ensure you are running 7-Zip with administrator rights.
For my blog I want to set 7-Zip for .zip files, so I have set this for all users. This writes to the following registry locations.
[HKEY_CLASSES_ROOT.zip] & [HKEY_CLASSES_ROOT\7-Zip.zip]
Export the registry keys from those locations and merge the contents into one .reg file. You will then have the content as below.
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\.zip] @="7-Zip.zip" [HKEY_CLASSES_ROOT\7-Zip.zip] @="zip Archive" [HKEY_CLASSES_ROOT\7-Zip.zip\DefaultIcon] @="C:\\Program Files\\7-Zip\\7z.dll,1" [HKEY_CLASSES_ROOT\7-Zip.zip\shell] @="" [HKEY_CLASSES_ROOT\7-Zip.zip\shell\open] @="" [HKEY_CLASSES_ROOT\7-Zip.zip\shell\open\command] @="\"C:\\Program Files\\7-Zip\\7zFM.exe\" \"%1\""
This can be converted to PowerShell at fellow MVP Roger Zander’s excellent web site Registry to PowerShell converter.
Simply paste the reg file content into the registry field and then click Get remediation script.
As if by magic your required PowerShell code will appear.
Note that I had to edit the final line to read
New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\7-Zip.zip\shell\open\command' -Name '(default)' -Value '"C:\Program Files\7-Zip\7zFM.exe"' -PropertyType String -Force -ea SilentlyContinue;
Save that off into a ps1 file.
Go to the Microsoft Endpoint Manager portal and click Devices\Windows\PowerShell scripts. Click Add.
Enter a Name for the script and click Next.
Browse for the ps1 file in the Script location field and then leave all other options as default. Click Next
Target the script to a device group and click through to complete the wizard.
Once the script applies, 7-Zip will be configured for .zip files.
You could use the same script to push via ConfigMgr also!