Azure Storage account

i created a simple script that copies zip files from an azure vm to an azure storage account.

it then delete all files except the most recent 3 files from the storage account

the storage account is a file share that is mapped on the azure vm as y:

i can open the script and run it and it works fine.

i scheduled the script with task scheduler on that vm like many others i created but it never runs.

i found in the event viewer -> powershell this error

Provider Health: Could not find the drive ‘Y:’. The drive might not be ready or might not be mapped…

Details:
ProviderName=Microsoft.PowerShell.Core\FileSystem
ExceptionClass=DriveNotFoundException
ErrorCategory=
ErrorId=
ErrorMessage=Could not find the drive ‘Y:’. The drive might not be ready or might not be mapped.

Severity=Warning

SequenceNumber=33

I am not sure why the script can find the y: drive when i run it manually but not when run from the task scheduler.

the task runs with highest privileges and wether user is logged on or not

any help is greatly appreciated

 

Ted

It is difficult assist you if you do not provide a script to troubleshoot. The best approach is adding logging to the script to get some verbose output when the script executes to troubleshoot.