You cannot call a method on a null-valued expression.
At L:\unzip.ps1:24 char:50
+ $destinationFolder.CopyHere($zipPackage.Items <<<< ())
+ CategoryInfo : InvalidOperation: (Items:String) , RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Thanks in advance
You're using the -Recurse switch for Get-ChildItem, which means that you could potentially be finding files such as "$spath\SubFolder\testSomething.zip". However, when you set up your $archiveFile variable, it would just contain "$spath\testSomething.zip", which probably wouldn't exist. Instead, you can just say $archiveFile = $file.FullName , which will automatically have the full path to the file and avoid such problems. I don't know if that's what's causing your current failure, though; you'd have to test and see.