Test-Path returns True but ExtractToDirectory Could not find path Test-Path returns True but ExtractToDirectory Could not find path powershell powershell

Test-Path returns True but ExtractToDirectory Could not find path


It seems like you might be mapping your drive in the earlier portion of the script with New-PSDrive. The drive created with that cmdlet is only visible within PowerShell, unless you use the -Persist switch. That switch creates it as an actual mapped drive (as though you had used net use or group policy or mapped it through explorer).

The .ExtractToDirectory method you're calling can't see any of the powershell provider namespaces, so it needs a real mapped drive or UNC path that's visible to the whole operating system.

Remember that if you're using -Persist you may also want to unmap the drive manually now.