I have written a PowerShell script that copies files from one mapped drive to another. Script runs fine when I run through PowerShell or command prompt. It mounts the both drives first and then wait for 10 second and then copies the files.
I now want to run the same script in Task scheduler but getting error.
Logon failure: the user has not been granted the requested logon type at this computer.
Task is configured to run with my account and I can run script in command prompt without any error. Is there any special permissions required for Task scheduler?
The script I used to map the drive
$LibraryURL =http://corpapps/cloud/documentLibary"
$Network = new-object -ComObject WScript.Network
$Network.MapNetworkDrive('D:', $LibraryURL)