It is currently Thu Mar 28, 2024 8:41 am

All times are UTC - 7 hours [ DST ]

Recent News:



Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Sat Jan 03, 2009 8:35 am 
Offline
Uber Moderator
Uber Moderator
User avatar

Joined: Sun Dec 02, 2007 3:29 am
Posts: 1736
Location: Brighton, England
Thanks: 27
Thanked: 202 times in 152 posts
I find it frustrating (as many of you do) that I have to manually start the Backup process of to my Servers Backup drive, and decided to see how easy it would be to automate this task.
What I now have is a working, automated Server Backup using a free, open-source utility called AutoHotKey.

If you download, and then install this on your server in an RDP session, you can then either record your own macro using the built in Macro Recorder or use the one below (save it as a text file with a .ahk extension). This should be good for most EX4xx users.

Before you record, or use the macro, first configure your backup settings if you haven't already (choose which folders you want to backup) and make sure the "Remember these settings for future backups" setting is ticked.

I've saved the script below into c:\admin and then run it as a scheduled task at 2200 every day.

Code:
Run, C:\Program Files\Windows Home Server\HomeServerConsole.exe
WinWait, Windows Home Server Console,
IfWinNotActive, Windows Home Server Console, , WinActivate, Windows Home Server Console,
WinWaitActive, Windows Home Server Console,
MouseClick, left,  182,  68
Sleep, 100
MouseClick, left,  114,  160
Sleep, 100
MouseClick, right,  114,  160
Sleep, 100
MouseClick, left,  162,  195
Sleep, 100
WinWait, Backup Now,
IfWinNotActive, Backup Now, , WinActivate, Backup Now,
WinWaitActive, Backup Now,
MouseClick, left,  200,  365
Sleep, 100
MouseClick, left,  200,  365
Sleep, 100


I'm going to write this up some detailed instructions to the Wiki today, but if anyone fancies diving in please give me some feedback on your experience.

_________________
Have you tried our Add-Ins? If so, be sure to Rate them at WeGotServed.
Help support MediaSmartServer.Net!


Top
 Profile  
Thanks  
The following user would like to thank Cougar for this post
All4Fun, SeaRay33, yakuza

Attention Guest: Remove this ad by Registering with the MediaSmartServer.net Forums. It's Free!
PostPosted: Sat Jan 03, 2009 12:31 pm 
Offline
Uber Moderator
Uber Moderator
User avatar

Joined: Sun Dec 02, 2007 3:29 am
Posts: 1736
Location: Brighton, England
Thanks: 27
Thanked: 202 times in 152 posts
Initial Wiki entry is now posted.

http://www.mediasmartserver.net/wiki/in ... der_Backup

_________________
Have you tried our Add-Ins? If so, be sure to Rate them at WeGotServed.
Help support MediaSmartServer.Net!


Top
 Profile  
Thanks  
The following user would like to thank Cougar for this post
Steve_S
PostPosted: Sat Jan 03, 2009 8:25 pm 
Offline
Top Contributor
Top Contributor
User avatar

Joined: Sat Feb 16, 2008 1:29 pm
Posts: 820
Location: Toronto, ON
Thanks: 12
Thanked: 11 times in 10 posts
I haven't tried this yet but will. This is very valuable and continues to make my investment in the EX470 a sound one. As WHS/Mediasmart continues to evolve and mature, I'm sure they'll be a lot more creativity coming out in the form of add-ins, automation, etc.

Thanks Cougar for this.

_________________
Richard

My gadget blog: http://www.gadgetinsane.com


Top
 Profile  
Thanks  
PostPosted: Sat Jan 03, 2009 9:36 pm 
Offline
Top Contributor
Top Contributor
User avatar

Joined: Sat Feb 16, 2008 1:29 pm
Posts: 820
Location: Toronto, ON
Thanks: 12
Thanked: 11 times in 10 posts
I just finished following your wiki instructions and everything worked.

I wasn't sure of the correct syntax to automate the Backup_Server.ahk file since .ahk is not an executable file. Amazingly, this utility also includes a tool to convert an .ahk file to a .exe file. I did that and in seconds, I had my .exe file that I could better automate using the Task Scheduler within Windows.

Admittedly, initially I had closed the Windows Home Server Console after clicking on "Hide" and my script didn't work as intended. When I followed the instructions, I didn't close the WHS Console and had no issues.

However, this implies to me that the script leaves the WHS Console open after the backup. I wonder how the script will behave when the WHS Console is left opened until the next scheduled backup?

I'll try this out and get back.

_________________
Richard

My gadget blog: http://www.gadgetinsane.com


Top
 Profile  
Thanks  
PostPosted: Sun Jan 04, 2009 7:56 am 
Offline
Top Contributor
Top Contributor
User avatar

Joined: Sat Feb 16, 2008 1:29 pm
Posts: 820
Location: Toronto, ON
Thanks: 12
Thanked: 11 times in 10 posts
I've been able to get my scheduled task to work. :( It shows as having started but nothing takes place. I tried with both the original .ahk file and created .exe file without success.

Cougar, what's the command line syntax you used for scheduling the task with Task Scheduler?

_________________
Richard

My gadget blog: http://www.gadgetinsane.com


Top
 Profile  
Thanks  
PostPosted: Sun Jan 04, 2009 11:12 am 
Offline
Uber Moderator
Uber Moderator
User avatar

Joined: Sun Dec 02, 2007 3:29 am
Posts: 1736
Location: Brighton, England
Thanks: 27
Thanked: 202 times in 152 posts
I did the same as you had suggested and compiled it to a .exe

So my command line is a simple c:\Admin\Backup_server.exe

Try adding a folder or file to one of your backup shares and set the scheduled start time to something imminent. If where you think it hasn't run based on the last backup job details, that's only updated if a file has been backed up.... sorry if I'm teaching you to suck eggs.

_________________
Have you tried our Add-Ins? If so, be sure to Rate them at WeGotServed.
Help support MediaSmartServer.Net!


Top
 Profile  
Thanks  
PostPosted: Sun Jan 04, 2009 12:10 pm 
Offline
Top Contributor
Top Contributor
User avatar

Joined: Sat Feb 16, 2008 1:29 pm
Posts: 820
Location: Toronto, ON
Thanks: 12
Thanked: 11 times in 10 posts
Thanks Cougar for your feedback. At least we are both doing the same thing. I'm sure it's something small (it always is).

I'll try it again at my next opportunity and see how it goes.

_________________
Richard

My gadget blog: http://www.gadgetinsane.com


Top
 Profile  
Thanks  
PostPosted: Mon Jan 05, 2009 7:54 pm 
Offline
Top Contributor
Top Contributor
User avatar

Joined: Sat Feb 16, 2008 1:29 pm
Posts: 820
Location: Toronto, ON
Thanks: 12
Thanked: 11 times in 10 posts
Re-did my script. Everything works fine now as a scheduled task.

_________________
Richard

My gadget blog: http://www.gadgetinsane.com


Top
 Profile  
Thanks  
PostPosted: Sat May 09, 2009 12:35 am 
Offline
Newbie
Newbie

Joined: Sat May 09, 2009 12:18 am
Posts: 1
Thanks: 0
Thanked: 0 time in 0 post
how did you manage to schedule the ahk exe? I am having the same problem with the windows scheduler.

I created the ahk macro according to the wiki instructions. I converted it to exe. I tested the exe and it works. I created a scheduled task then logged of the RDP session. The job get triggered at the scheduled time but it hangs there forever.

Am I missing something here?


Top
 Profile  
Thanks  
PostPosted: Sun May 23, 2010 3:04 pm 
Offline
Newbie
Newbie

Joined: Sun May 23, 2010 2:32 pm
Posts: 4
Thanks: 0
Thanked: 3 times in 3 posts
Hello Cougar,

thank you very much for this great solution. After hours of searching for an addin or some command line call to trigger the server backup, I found your idea. It works for me. Because I have a german WHS system I had to change some things like the window titles and I ended up recording and writing my own script.

When I started to modify the script, I had problems with the timing. 100ms sleep time is very quick and may not work on slower systems.

Edit: Hmm, it seems there are still some problems. I was not aware of the behaviour of the windows home server-console. When starting the whs-console on the remote desktop, any console started from a remote tray is killed. Vice versa when starting a console via remote tray, the whs-console on the remote desktop is killed.
If a console is killed, any pending server-backup will stop! The data is already copied to the backup storage to that point. But you can only restore, if a backup is finished successfully.

From my perspective this means
a) This backup automation attempt will work, if you use the whs-console in the remote desktop session only (never with tray) and you never logoff (only disconnect).
b) The scheduler entry is created with "only if logged in" setting checked.
c) The console must run as long as the server backup takes (what I have posted earlier was completely wrong concerning this).


Top
 Profile  
Thanks  
The following user would like to thank myberg for this post
yakuza
PostPosted: Thu Jun 10, 2010 3:43 pm 
Offline
.5TB storage
.5TB storage

Joined: Thu Jun 03, 2010 4:15 pm
Posts: 21
Thanks: 1
Thanked: 0 time in 0 post
is there a way to automate deletion of older files? say if i want to delete backup files that are older than 10 days?


Top
 Profile  
Thanks  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 7 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group