Разархивировать файл на нескольких серверах? - PullRequest
0 голосов
/ 07 сентября 2018

Я создал этот простой код, но получаю «Развернуть-Архив: Путь« C: \ Users \ XXX \ C $ \ temp \ Oracle Clients \ win32_11gR2_client.zip »либо не существует, либо не является допустимым файлом системный путь. "

Я просто хочу извлечь $ destinationRoot в папку $ targetRoot. Чего мне не хватает?

[String] $KfxComputers = "C:\temp\Kofax Apps\servers.txt"

# This file contains the list of servers you want to copy files/folders 
to
$computers = get-content -Path $KfxComputers

$destinationRoot = 'C$\temp\Oracle Clients\win32_11gR2_client.zip'
$targetRoot = 'C$\temp\Oracle Clients\win32_11gR2_client'

foreach ($computer in $computers) {

$testpath = Test-Path -Path \\$computer\$destinationRoot

if ($testpath) 
{
   Write-Host "extract file..." -ForegroundColor green

   Expand-Archive -Path $destinationRoot -DestinationPath $destinationRoot -Force -ErrorAction SilentlyContinue

   Write-Host "Completed" -ForegroundColor Green
} 
Else {
   Write-Host "Failed" -ForegroundColor green
  }
}
...