none
Task scheduled vbscript cannot access mapped drive when run on logged off remote computer

    Question

  • I have set up a scheduled task on a remote computer to run a vbscript every day at a set time. The vbscript contains the following instructions...

    ...

    strEntry = "File was copied into OpenBatch successfully."

    iCopy = 1 'this is set to one for the purposes of this illustration but it can be 0

    If iCopy = 1 Then
     strEntry = "1 - " & strEntry
    Else
     strEntry = "0 - " & strEntry
    End if

    Set objFsoDetails = CreateObject("Scripting.FileSystemObject")
    Set objFSO = objFsoDetails.OpenTextFile("\\tsclient\V\Hyper\Senelstun\ClearData\EmailBody.txt", ForWriting)

    objFSO.WriteLine strEntry
    objFSO.Close

    ...

    If I run this vbs while I am logged into this remote computer via termninal services either via manually running it or running the scheduled task it works fine, but this bit of script does not work if I am logged out of terminal services. i.e. in the early morning around 00:15 when this schedule task is run this bit of code does not execute (everything above it works fine). When I log into the task scheduler it shows that the task is still running.

    I must be using the wrong format for the file path, can anyone help?

    Ta v much

    Rob

    Thursday, January 03, 2013 11:49 AM

Answers

  • \\tsclient does not exist outside of a ts session.  It is NOT a mapped drive. \\tsclient is s pseudo-share established by the tsclient.


    Happy New Year ¯\_(ツ)_/¯

    Thursday, January 03, 2013 12:52 PM
  • Thank you for making that clear...does that mean this problem cannot be solved by applying another path?

    I appreciate you coming back so soon.

    You can use any real path to any real share.  YOU cannot use any path to a share that is not visible from the server when logged on locally.


    Happy New Year ¯\_(ツ)_/¯

    Thursday, January 03, 2013 6:35 PM

All replies

  • \\tsclient does not exist outside of a ts session.  It is NOT a mapped drive. \\tsclient is s pseudo-share established by the tsclient.


    Happy New Year ¯\_(ツ)_/¯

    Thursday, January 03, 2013 12:52 PM
  • Thank you for making that clear...does that mean this problem cannot be solved by applying another path?

    I appreciate you coming back so soon.

    Thursday, January 03, 2013 1:01 PM
  • Thank you for making that clear...does that mean this problem cannot be solved by applying another path?

    I appreciate you coming back so soon.

    You can use any real path to any real share.  YOU cannot use any path to a share that is not visible from the server when logged on locally.


    Happy New Year ¯\_(ツ)_/¯

    Thursday, January 03, 2013 6:35 PM