Windows task to log in

MyDanes
MyDanes used Ask the Experts™
on
Is there a way to schedule a Windows task to log in a server before running scheduled Automate tasks? The OS, Windows Server 2008, will not allow Automate to log in the Administrator before running the tasks.  Thank you in advance
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Justin OwensITIL Problem Manager

Commented:
For clarification purposes, you are wanting to automate a console log on prior to a Scheduled Task running?  For what purpose?

Author

Commented:
I'm sorry - perhaps I was not very clear. No, I do not need a log. The server locks after a period of inactivity, and needs to be logged back in or unlocked before any of the tasks will run.
Justin OwensITIL Problem Manager

Commented:
I am confused.  Scheduled tasks are just that.  They should run even if no user is logged in at all.  What type of task are you trying to run which would require the console to be both logged in and unlocked?
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Author

Commented:
I realize that is how it should work. I have Automate 7 on a Windows 2008 server. The tasks are essentially batch files that are supposed to copy .bak files (database backups from SQL Server) to a separate local folder, renaming them to reflect the current date, then copying the backups into an external ShareSpace drive. Initially I thought it was a problem with mapping the network drive, which is one of the Automate steps, however the other tasks (copying to local folder and rename) are also not executing either. Everything runs as it should when the Administrator user is logged in, so I know it is not the batch files. I have Automate set to login Administrator when the desktop is locked/logged out. However I have discovered upon doing some research that the Windows Server 2008 OS will not allow Automate to do so. I believe my best course of action would be to schedule a Windows task to login the server, perhaps using a batch file? Thanks for your help
ITIL Problem Manager
Commented:
OK... Scheduled tasks run with whatever permission they are told to, whether logged in at the console or not.  The only thing which would require you to be logged in would be if you used mapped drives.  I Would suggest modifying your batch files to use only UNC paths.  (Also, batch files run from scheduled tasks should have an EXIT at the end of them to avoid the task hanging and not running again)

That should 1) eliminate your need to have a user logged in and 2) also eliminate your need for Automate 7.

Author

Commented:
Thank you. Testing now

Author

Commented:
I am now remembering why I used Automate for this in the first place... task scheduler will not reconnect the mapped network drive (a WD ShareSpace) using the following batch script, even when I am logged in as adminstrator:

net use S: /delete
net use S: \\192.168.1.218\sqlbackup /user:admin admin /persistent:yes
exit

Task Scheduler shows that it ran successfully, but when I check the drive it is not connected. I can run the script manually.  This drive must be connected for the next step to run:

xcopy  f:\visual\backups\daily \\192.168.1.218\SQLBackup\daily
exit

Any ideas? Thanks for your assistance.
Justin OwensITIL Problem Manager

Commented:
That is what I meant when I said to not use mapped drives, but to use UNC paths.

Is "F" a mapped drive or a physical drive?  Is "Daily" a file name or a folder name?

It would help if you could post what all your batch files are doing, even if you have to sanitize it a little....

Author

Commented:
F is a physical drive, and Daily is a folder name. I believe the xcopy step is using UNC paths? \\192.168.1.218\SQLBackup\daily

Sure - here are the steps of the batch files.

Step 1 (runs successfully through task scheduler) - has 2 'Actions'
daily_copy_to_local_scanpac.bat:
copy f:\visual\backups\scanpac.pm.bak f:\visual\backups\daily
exit

daily_copy_to_local_sppay.bat:
copy f:\visual\backups\sppay.pm.bak f:\visual\backups\daily
exit

Step 2 (runs successfully) - also has 2 actions
daily_rename_scanpac.bat:
FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set date=%%c%%a%%b)
REN f:\visual\backups\daily\scanpac.pm.bak %DATE%.ScanPac.daily.bak
exit

daily_rename_sppay.bat:
FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set date=%%c%%a%%b)
REN f:\visual\backups\daily\sppay.pm.bak %DATE%.Sppay.daily.bak
exit

Step 3 (runs successfully in Automate when user is logged in, but will not run at all in Task Scheduler)
wdss.bat:
net use S: /delete
net use S: \\192.168.1.218\sqlbackup /user:admin admin /persistent:yes
exit

Step 4 (runs successfully in Automate when user is logged in, but will not run at all in Task Scheduler)
xcopy  f:\visual\backups\daily \\192.168.1.218\SQLBackup\daily
exit

The last step shows a Last Run Result of (0x4). The other 3 show a result of 'The operation completed successfully. (0x0)' Does that have any meaning to you?

Any ideas how to alter my steps and batch scripts to get the copy to the external drive to run successfully, both when Administrator is logged in and logged out? Thanks for all your help
Commented:
Thanks for your assistance - finally resolved the problem by setting up a task in Automate to connect the network drive, then synchronize the local 'Daily' folder and the external 'Daily' folder. This will run in the background when the server is locked and when it is logged off.
Justin OwensITIL Problem Manager

Commented:
Great!  Glad you got it working.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial