troubleshooting Question

PowerShell

Avatar of AXISHK
AXISHK asked on
Powershell
1 Comment1 Solution183 ViewsLast Modified:
I can't use the "system.io.compression.filesystem" in my powershell .NET Framework 4.7 has been installed. Any idea ?

Thx

if(Test-path $$ZipLog ) {Remove-item $$ZipLog}
Add-Type -assembly "system.io.compression.filesystem" [io.compression.zipfile]::CreateFromDirectory($ZipSourceDir, $ZipLog = "C:\MyBackup\test.zip")

PS C:\Windows\system32> C:\MyBackup\mytest.ps1
Add-Type : A positional parameter cannot be found that accepts argument '[io.compression.zipfile]::CreateFromDirectory'.
At C:\MyBackup\mytest.ps1:18 char:1
+ Add-Type -assembly "system.io.compression.filesystem" [io.compression.zipfile]:: ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Add-Type], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.AddTypeCommand
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros