Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

GPO Computer Startup Script to copy a file from my NAS to my computer.

$
0
0

So I have a script that runs fine manually and does run when applied via gpo, but it does not work correctly when applied this way. It's suppose to copy a file from my NAS to my desktop. I've isolated the error down to this:

Copy-Item : Cannot find path 
'UNC Path' because it does not 
exist.

The path does exist and works fine when I fire the script manually. I've tried having the gpo wait for the network to be established but this did not work either. I'm stumped as to why this error is occurring and I'd appreciate any help!

Here is a copy of the script. It's very basic because it's a test script to try to isolate the issue.

$TEST_INSTALL="\\path_to_file\test.txt"
$TEST_FILE="C:\test.txt"
$INSTALLED_ALREADY=Test-Path $TEST_FILEif($INSTALLED_ALREADY -ne $true){Copy-Item-Path $TEST_INSTALL -Destination $TEST_FILE -Force2>>"C:\errors.txt"}else{Write-Host"Already Installed"exit}


Viewing all articles
Browse latest Browse all 21975

Trending Articles