The following example doesn't seem to work on my Windows Server 2008 SP2 nor my Windows 7 Pro Sp1.
Command:
$shellapp = new-object -com shell.application
$shellapp
Output:
Application Parent
----------- ------
System.__ComObject System.__ComObject
Command:
$zipfile = $shellapp.namespace("c:\temp\file.zip")
$zipfile
Output: No output? (I'm assuming it didn't work and $zipfile is null)
Command:
$zipfile.copyhere("c:\temp\file.txt")
Output:
You cannot call a method on a null-valued expression.
At line:1 char:18
+ $zipfile.copyhere <<<< ("file.txt")
+ CategoryInfo : InvalidOperation: (copyhere:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
I've tried to re-associate .Zip
with the instructions: How to restore Windows default Zip file functionality?.
I've also tried to re-register with regsvr32.dll zipfldr.dll
with no success.