MyDanes
asked on
Windows task to log in
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
For clarification purposes, you are wanting to automate a console log on prior to a Scheduled Task running? For what purpose?
ASKER
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.
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?
ASKER
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you. Testing now
ASKER
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.
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\
exit
Any ideas? Thanks for your assistance.
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....
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....
ASKER
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_scanpa c.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\sc anpac.pm.b ak %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\sp pay.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
Sure - here are the steps of the batch files.
Step 1 (runs successfully through task scheduler) - has 2 'Actions'
daily_copy_to_local_scanpa
copy f:\visual\backups\scanpac.
exit
daily_copy_to_local_sppay.
copy f:\visual\backups\sppay.pm
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\sc
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\sp
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\
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
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Great! Glad you got it working.