79216546

Date: 2024-11-22 21:02:13
Score: 1
Natty:
Report link

If you add the following line to your startup profile, the error goes away permanently.

Add-Type -Path "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.IO.Compression.dll" -ReferencedAssemblies System.IO.Compression

To get the location of your startup profile, type $profile while in PowerShell or PowerShell ISE. For ISE,it will look like Powershell_ise.ps1

For some weird reason, even though you put that at the top of the script where you're going to use system.io.compression, it doesn't see it unless you highlight that line and run selection.

By putting the line in your startup profile, it loads the assembly, and your script will run.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Da808Wiz