none
PowerShell launched by a Scheduled Task cannot access files on a UNC share RRS feed

  • Question

  • We have some PowerShell scripts that use Get-ChildItem from a UNC share.  The script executes fine when launched from ISE and when launched from PowerShell, however when scheduled with windows Task Scheduler the job fails. The error message is Permission Denied or drive not found. The User for the scheduled task has full control and can execute the job with ISE.  Another note, we have been successfully using this method for a few years and it just recently has started to fail.

    we have the scheduled task set to run whether user is logged on or not and run with highest privileges. (actually tried every combination to no avail)

    any ideas as to what we can try? 

    Friday, January 25, 2019 4:02 PM

Answers

All replies

  • you can use this script to test

    Start-Transcript logfile.log

    Test-Path \\server\share

    Stop-Transcript

    Friday, January 25, 2019 4:10 PM
  • If it works interactively, then you don't have a scripting question.

    There's not a way for us to troubleshoot this for you from afar in a forum, unfortunately.


    -- Bill Stewart [Bill_Stewart]

    Friday, January 25, 2019 4:26 PM
    Moderator
  • This is a known issue with one of the last updates from MS.  Contact MS support for assistance with a patch if they have one available.


    \_(ツ)_/

    Friday, January 25, 2019 5:00 PM
  • We found the issue, it is a SMB - cname issue. we were using an alias (DNS) in the UNC path. this worked in SMB1 but not in SMB2/3
    Friday, January 25, 2019 7:19 PM