cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to copy a file to an Egnyte folder using Powershell script via Task Scheduler

Irwin Matthies
Vigilante

Unable to copy a file to an Egnyte folder using Powershell script via Task Scheduler

Hello,

I have a Powershell script that I want to use to copy a file from a domain server location up to an Egnyte folder.  The file needs to be uploaded automatically so I am trying to use the Task Scheduler on a Server 2008 R2 server.  The server has Egnyte Connect v. 2.1.1.65 installed and I have regular access to the Egnyte folder via a mounted drive letter "Y:".  The Powershell scripts runs fine on its own if I use the drive letter but fails miserably when it runs through the Scheduler.  I have tried using "\\egnytedrive\<domainaccount>@<Egnytedomain>\Shared\" but I receive an error telling me that the path doesn't exist.  Any insight would be appreciated.

Thanks

Irwin

Labels (2)
0 Kudos
8 Replies
Retired Employee Sagar
Retired Employee

Re: Unable to copy a file to an Egnyte folder using Powershell script via Task Scheduler

Hi @Irwin Matthies,

Can you try to change the \\egnytedrive\<domainaccount>@<Egnytedomain>\Shared\actual folder name ?

I suspect it might be a case of the file being attempted to be uploaded to directly under the Shared which is not permitted. The file has to go under some folder under the Shared. 

Let me know if this helps.

Thanks

PS. Help others find answers by selecting "Accept as Solution" if a post answers your question."
0 Kudos
Irwin Matthies
Vigilante

Re: Unable to copy a file to an Egnyte folder using Powershell script via Task Scheduler

Hello Sagar,

For brevity's sake I trimmed the actual location down a bit.  Here is the actual location (minus sensitive data) \\egnytedrive\<domainaccount>@<egnyte domain>\Shared\YCM\30 Day Folder\Distribution\.  I've put the whole address in quotes (becasue of the spaces) and I've tried it with and without the final "\" as well.  I also have permission to access the folders.

Regards,

Irwin

0 Kudos
Retired Employee Sagar
Retired Employee

Re: Unable to copy a file to an Egnyte folder using Powershell script via Task Scheduler

@Irwin Matthies,

I am sorry I am no expert with powershell scripting, but just wondering if you could share your script and also the output of the error you are seeing when you attempt to copy the file. 

Secondly, have you tried writing a file to any other network drive ? Does that work and if it does what destination format are you using there ? 

Thanks.

PS. Help others find answers by selecting "Accept as Solution" if a post answers your question."
0 Kudos
Irwin Matthies
Vigilante

Re: Unable to copy a file to an Egnyte folder using Powershell script via Task Scheduler

Hello Sagar, Is there a way I can send you the files as attachments as the code and transcript are somewhat large? For your other question, I write to other network drives, via Powershell scripts, on a regular basis without issue. I can use either the FQDN for the drive or the drive letter in the script without issue. I can do the same with the script in question if I run it interactively but I need to run it as a scheduled job which is when it fails. Irwin
0 Kudos
Retired Employee Sagar
Retired Employee

Re: Unable to copy a file to an Egnyte folder using Powershell script via Task Scheduler

@Irwin Matthies,

I just need a snippet of the error or the output when the transfer fails. I will check with a few people I know to see how can we make this to work. 

Thanks.

PS. Help others find answers by selecting "Accept as Solution" if a post answers your question."
0 Kudos
Irwin Matthies
Vigilante

Re: Unable to copy a file to an Egnyte folder using Powershell script via Task Scheduler

Sorry for the delay.  Here is the error message:

VERBOSE: Performing operation "Copy File" on Target "Item:
E:\Scripts\testdata\Deliveries_15May18.txt Destination:
\\egnytedrive\<domainuser>@<egnytedomain>\Shared\YCM\30 Day Folder\Distribution Centre".

copy-item : The network path was not found.
At E:\scripts\DeliveryList.ps1:45 char:1

+ copy-item $OutFile $MovePath -verbose

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   
+ CategoryInfo          : NotSpecified: (:) [Copy-Item], IOException
   
+ FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand

 I can run it without issue interactively but this is the message I get when I try running it through the Windows Scheduler.

Irwin

0 Kudos
Retired Employee Sagar
Retired Employee

Re: Unable to copy a file to an Egnyte folder using Powershell script via Task Scheduler

Thankyou @Irwin Matthies,

Let me see what help I can get on this one. I will write back once I have something that can help.

Thanks.

PS. Help others find answers by selecting "Accept as Solution" if a post answers your question."
0 Kudos
Retired Employee Sagar
Retired Employee

Re: Unable to copy a file to an Egnyte folder using Powershell script via Task Scheduler

Hello Irwin,

I discussed this issue with my internal resources. Two things to be looked at.

- Is the Windows scheduler job running as administrator or as your profile?

If the job is running as admin, the drives won't be visible because the admin is considered a different user and our drives are not visible to other users on the same machine for security reasons.

- Or the scheduler should also run at the same time that our app is running (so the user should be logged in at the time)

Thanks.

PS. Help others find answers by selecting "Accept as Solution" if a post answers your question."
0 Kudos