Jump to content

Recommended Posts

Posted

I have an autoit script that maps two drives and closes.  have it set to run as a Windows 10 scheduled task.  Running it manually form the desktop it works fine.  When I remote desktop to the desktop after a reboot, scheduled task shows it runs, but there are no mapped drives.  Windows 10 set to auto login.  Logging in with the same user remotely that it auto logs in with and the schedule task is set to run as.  Is there some additional setting to make this really run as the person on the desktop?

Thanks.

 

JR

  • Moderators
Posted

Moved to the appropriate forum.

Moderation Team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted
29 minutes ago, jriker1 said:

I have an autoit script that maps two drives and closes <etc..>

Can you share a copy of the script that is changed a little so it doesn't show your actual user credentials or other private information?

Always carry a towel.

Posted

You bet.  Guessing the script itself is probably not the issue, more something I need to maybe set in Scheduled Task:

 

#include <AutoItConstants.au3>
$sUsername="<domain>\<username>"
$sPassword="<password>"
DriveMapDel("X:")
Sleep(2500)
DriveMapAdd("X:", "\\homeserver\e$", $DMA_DEFAULT, $sUsername, $sPassword)
DriveMapDel("Y:")
Sleep(2500)
DriveMapAdd("Y:", "\\mediacenter\d$", $DMA_DEFAULT, $sUsername, $sPassword)
 

 

Also Scheduled task:

- Trigger at Logon any user

 

This is the only part I'm wondering, if I change it to run as me if it would od anything.  Not sure what any user is anyway.

 

Thanks.

 

JR

Posted

Please use code tags when posting example code (the "<>" in the post controls).

Can you try to capture the return from DriveMapAdd to a logfile like below?

#include <AutoItConstants.au3>
#include <File.au3>

$sUsername="<domain>\<username>"
$sPassword="<password>"

$s_delRet = DriveMapDel("X:")
_FileWriteLog(@ScriptDir & "\DriveMapLog.log", "Deletion of X: returned " & $s_delRet)
Sleep(2500)
$s_mapRet = DriveMapAdd("X:", "\\homeserver\e$", $DMA_DEFAULT, $sUsername, $sPassword)
_FileWriteLog(@ScriptDir & "\DriveMapLog.log", "Mapping of X: returned " & $s_mapRet)

$s_delRet = DriveMapDel("Y:")
_FileWriteLog(@ScriptDir & "\DriveMapLog.log", "Deletion of Y: returned " & $s_delRet)
Sleep(2500)
$s_mapRet = DriveMapAdd("Y:", "\\mediacenter\d$", $DMA_DEFAULT, $sUsername, $sPassword)
_FileWriteLog(@ScriptDir & "\DriveMapLog.log", "Mapping of Y: returned " & $s_mapRet)

 

Always carry a towel.

Posted (edited)

OK I'll give this a try.  Stay tuned.  For reference is 0 or 1 good.  I ran this manually and got a 0 for the X: drive and a 1 for the Y: drive and the Y: drive was mapped and the X: drive wasn't.  This is a manual run.

 

EDIT:  Should also say I'm seeing that for some reason the X: fails on Windows 10 and Y: works.  On WIndows 8 both work.


EDIT EDIT:  What's interesting even though I get a 0 or 1 on some and in File Explorer just shows the Y: drive, if I drop to an admin DOS prompt and do a net use, it shows both X: and Y: mapped.  Odd it's not showing in Windows File Explorer plus having errors.

Thanks.

 

JR

Edited by jriker1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...