Task scheduler dont copy but manually does

I have a little script for copying zipped file

[string]$zipFN_1 = 'D:\FOLDER_TEST\'
[string]$cvm = "GDRIVE"
[string]$name = $cvm + "_" + (get-date -UFormat “%Y_%m_%d”)
[string]$zipFN = $zipFN_1 + $name + '.zip'
[string]$fileToZip = 'D:\FOLDER_TEST\GDRIVE_2021.gdb'
Compress-Archive -Path $fileToZip -Update -DestinationPath $zipFN
Copy-Item -Path $zipFN -Destination 'Q:\Backup .GDRIVE\' -Force

this Q is mapped drive. And when i tried this code in powershell it copy it.
I added -Force but it didnt help.

copy it or didn’t copy ?

Since it is a mapped drive, does the account used to run the scheduled task have permissions to write to that location ?

When i run commands manualy it copy it.
Just dont copy when use task scheduler.
It is Administrator account.

Does this Administrator account actually get this drive mapped? I’d recommend to use UNC paths anyway. Usually it’s less error prone and more robust.

you think like this:

Copy-Item -Path 'c:\myfolder\myfile' -Destination '\\\Backup .GDRIVE\'

I’d prefer to use a name instead of an IP address but yes, that’s what I meant. :wink: