Jump to content

Scheduled Task will not work with autoIT script.


 Share

Recommended Posts

Hi I have written a script in autoIT to make a backup of an exchange mailbox on small business server 2011. I am not very experienced with autoIT but the script works when I double click it. My problem is that I scheduled it to run every day in task scheduler, and task scheduler says that it ran successfully, but it did not make the backup. Does anyone know why it is not working?

Here is the script:

Send("{LWIN}")
;Presses left windows key
Sleep(2000)
;waits two seconds
Send("Exchange Management Shell")
;Enters text
Sleep(2000)
;waits two seconds
Send("{ENTER}")
;Opens Exchange Management Shell
Sleep(30000)
;waits 30 seconds
$EnterString1 = "New-MailboxExportRequest -Mailbox pielmeier -FilePath \\Susan-pc\alwi\mailboxbackups\Dave\"
$EnterString2 = "davemailbox-" & @MON & "-" & @MDAY & "-" & @YEAR & "-" & @HOUR & "-" & @MIN & ".pst"
Send($EnterString1)
;Enters command
Sleep(2000)
;waits two seconds
Send($EnterString2)
;enters command
Sleep(2000)
;waits two seconds
Send("{ENTER}")
;Presses enter
Sleep(30000)
;waits 30 seconds
Send("exit")
;types Exit
Sleep(2000)
;waits two seconds
Send("{ENTER}")
;Presses enter

Link to comment
Share on other sites

That script won't work unless the server is logged on to and it is running visible, neither of which are probably true.

 

https://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F

 

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • 3 years later...
  • Moderators

@jalexandar did you happen to notice this post is over 3 years old? Please don't resurrect old threads, especially to give incorrect suggestions.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...