# Task scheduler dont copy but manually does

**URL:** <https://forums.powershell.org/t/task-scheduler-dont-copy-but-manually-does/16689>\
**Category:** PowerShell Help\
**Created:** [May 31, 2021, 6:29am UTC](https://forums.powershell.org/t/task-scheduler-dont-copy-but-manually-does/16689 "2021-05-31T06:29:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mercyangel](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@mercyangel](https://forums.powershell.org/u/mercyangel)\
**Post date:** [May 31, 2021, 6:29am UTC](https://forums.powershell.org/t/task-scheduler-dont-copy-but-manually-does/16689/1 "2021-05-31T06:29:25Z")

</div>

I have a little script for copying zipped file

```auto
clear-host
[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.

---

<div class="post-metadata">

**Author:** ![kvprasoon](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kvprasoon/32/4449_2.png) [@kvprasoon](https://forums.powershell.org/u/kvprasoon)\
**Post date:** [May 31, 2021, 6:33am UTC](https://forums.powershell.org/t/task-scheduler-dont-copy-but-manually-does/16689/2 "2021-05-31T06:33:44Z")

</div>

> [@mercyangel](#):
>
> And when i tried this code in powershell it copy it.

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 ?

---

<div class="post-metadata">

**Author:** ![mercyangel](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@mercyangel](https://forums.powershell.org/u/mercyangel)\
**Post date:** [May 31, 2021, 6:43am UTC](https://forums.powershell.org/t/task-scheduler-dont-copy-but-manually-does/16689/3 "2021-05-31T06:43:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [May 31, 2021, 7:18am UTC](https://forums.powershell.org/t/task-scheduler-dont-copy-but-manually-does/16689/4 "2021-05-31T07:18:59Z")

</div>

> [@mercyangel](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![mercyangel](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@mercyangel](https://forums.powershell.org/u/mercyangel)\
**Post date:** [May 31, 2021, 9:44am UTC](https://forums.powershell.org/t/task-scheduler-dont-copy-but-manually-does/16689/5 "2021-05-31T09:44:19Z")

</div>

> [@Olaf](#):
>
> UNC paths

you think like this:

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

```

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [May 31, 2021, 3:46pm UTC](https://forums.powershell.org/t/task-scheduler-dont-copy-but-manually-does/16689/6 "2021-05-31T15:46:01Z")

</div>

> [@mercyangel](#):
>
> you think like this:

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

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:24pm UTC](https://forums.powershell.org/t/task-scheduler-dont-copy-but-manually-does/16689/7 "2024-05-16T20:24:20Z")

</div>


