Thought this would be simple but.. i'm not a programmer im just trying to make something more efficient than having to re-type command after command on 20 systems mistakes happen.
so what im trying to do is copy a directory from a remote system to a USB drive replace a hardware image and then copy the directory back sounds simple enough I think it may be a double hop issue but I am lacking in how to fix it I am using a Domain Admin acccount and running powershell as administrator.
Clear #Clear Screen
$USBDrive = read-host -prompt "Drive letter for USB Drive?" #Get Drive Letter for EXT Media
cd $USBDrive':' #Change to external media drive
$BGM = read-host -prompt "# of BGM's?" #QTY of BGM's
# Create copies of Convertor Files
DO{
Write-Host BGM# $BGM
Test-Path \\172.16.10.$BGM"\c$\Program Files\Box Tech\BoxManager Version 3.7\172.16.10."$BGM"_cvtrdata"
New-item \App0$BGM -itemType Directory
Copy-Item -path \\172.16.10.$BGM"\c$\Program Files\Box Tech\BoxManager Version 3.7\172.16.10."$BGM"_cvtrdata" -destination \\App0$BGM\ -Recurse
$BGM = $BGM - 1
}
WHILE($BGM -gt 0)
Test-Path returns that it directory does not exist, Test-Path \172.16.10.$BGM"\c$\Program Files\Box Tech\BoxManager Version 3.7\172.16.10."$BGM"_cvtrdata" If I use the exact path it returns true in test-path Test-Path "\172.16.10.1\c$\Program Files\Box Tech\BoxManager Version 3.7\172.16.10.1_cvtrdata"
but the copy fails I wold even be happy using robocopy to copy the files.