Avatar of AXISHK
AXISHK

asked on 

PowerShell

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
Powershell

Avatar of undefined
Last Comment
Jose Gabriel Ortega Castro

8/22/2022 - Mon