Hopefully I can explain this in a way that makes sense. :) Because of the problems I've had with the LinkStation logging me off all the time and because of the large number of users I needed to add, I wrote some scripts using AutoHotkey (can be downloaded for free from http://www.autohotkey.com) to automate the process. This is the breakdown of the main script:
1. Open a window asking for the IP address of the drive
2. Write out a .bat file that the user will use to backup their computer
3. Add in a new user
4. Log off the LinkStation and sign back in
5. Add in a new share for the user
6. Log off the LinkStation and sign back in
7. Repeat back to 2 until all users added
The list of users are in a text file called names.txt. Our usernames are in the format FirstName_LastName in Active Directory, so the text file just has the person's first and last name. The script will combine them together into FirstName_LastName for the username and uses the first letter of the first name and the complete last name for the share name.
We use robocopy for backing up the computers. It's fast, small (just one executable file needed) and reliable. It ships with Vista and can be downloaded from Microsoft for free for 2000 and XP. When the script runs, it creates a .bat file for the user to backup their computer. Here's a sample .bat file that would back up the Desktop, Favorites and My Documents on a pc:
---------------------------------------------------------------------------------------------------
if exist \\192.168.1.1\FLastName goto backup
goto error
:backup
robocopy "c:\Documents and Settings\FirstName_LastName\Desktop" \\192.168.1.1\FLastName\backup\Desktop /fft /eta /mir /r:0 /w:0
robocopy "c:\Documents and Settings\FirstName_LastName\Favorites" \\192.168.1.1\FLastName\backup\Favorites /fft /eta /mir /r:0 /w:0
robocopy "c:\Documents and Settings\FirstName_LastName\My Documents" "\\192.168.1.1\FLastName\backup\My Documents" /fft /eta /mir /r:0 /w:0
goto end
:error
cd\
cls
rem
rem =============================================================
rem // \\
rem || WARNING!! Backup Drive Not Found ||
rem || ||
rem || Make sure drive is plugged in and turned on and try again ||
rem \\ //
rem =============================================================
rem
rem Drive IP: 192.168.1.1
pause
:end
---------------------------------------------------------------------------------------------------
The remainder of the script adds a new user and a shared directory for them. I tried to comment the code fairly well so you get an idea of what it's doing. AutoHotkey is a really easy scripting language to learn. I had never used it before this project and wrote the script below after just a little messing around.
I tried to keep it as generic as possible, but you'll probably need to do some fine tuning depending on your situation, especially the format of your usernames. You may need to adjust some of the Sleep commands if you find it's not pausing long enough between commands. Also, some of the commands below send {TAB}'s to get to a certain place on the screen. You may need more or fewer {TAB}'s depending on your web browser and what toolbars you have. There's also a few commands that click specific buttons on the screen. I couldn't find a way to select the LinkStation menu buttons on the left of the screen with keystrokes only, so you may need to adjust the x,y coordinates of the clicks according to your web browser (AutoHotkey comes with a program called AutoIt3 Window Spy that makes it really simple to determine coordinates).
Hopefully that will be enough to get you going. It may seem a little daunting at first, but once you get used to some of the basic AutoHotkey commands, it's pretty simple. If anyone tries this and gets stuck, post a message on here and I'll try and help you out.
Everything below gets copied into a script file with a .ahk extension:
;Display window that asks for IP address
InputBox, IP, IP, Enter IP:
;Read in names, one at a time, from names.txt
FileRead, BackupFile, Names.txt
Loop, Parse, BackupFile, `n, `r
{
Name = %A_LoopField%
;Put first and last name into separate variables
StringSplit, NameArray, Name, %A_Space%
FirstName = %NameArray1%
LastName = %NameArray2%
;Convert username to lower case
UserName = %FirstName%_%LastName%
StringLower, UserName, UserName
;Make share name on LinkStation from username
StringLeft, FirstLetter, FirstName, 1
ShareName = %FirstLetter%%LastName%
;Write .bat file that copies files to backup drive
Run, Notepad
WinWait, Untitled,
IfWinNotActive, Untitled, , WinActivate, Untitled,
WinWaitActive, Untitled
Send, if exist \\%IP%\%ShareName% goto backup{ENTER}
Send, {ENTER}
Send, goto error{ENTER}
Send, {ENTER}
Send, :backup{ENTER}
Send, robocopy "c:\Documents and Settings\%UserName%\Desktop" \\%IP%\%ShareName%\backup\Desktop /fft /eta /mir /r:0 /w:0{ENTER}
Send, robocopy "c:\Documents and Settings\%UserName%\Favorites" \\%IP%\%ShareName%\backup\Favorites /fft /eta /mir /r:0 /w:0{ENTER}
Send, robocopy "c:\Documents and Settings\%UserName%\My Documents" "\\%IP%\%ShareName%\backup\My Documents" /fft /eta /mir /r:0 /w:0{ENTER}
Send, goto end{ENTER}
Send, {ENTER}
Send, :error{ENTER}
Send, cd\{ENTER}
Send, cls{ENTER}
Send, rem{ENTER}
Send, rem ============================================================={ENTER}
Send, rem // \\{ENTER}
Send, rem || WARNING{!}{!} Backup Drive Not Found ||{ENTER}
Send, rem || ||{ENTER}
Send, rem || Make sure drive is plugged in and turned on and try again ||{ENTER}
Send, rem \\ //{ENTER}
Send, rem ============================================================={ENTER}
Send, rem{ENTER}
Send, rem Drive IP: %IP%{ENTER}
Send, pause{ENTER}
Send, {ENTER}
Send, :end
Send, !fa
WinWaitActive, Save As
Send, c:\LinkStation\%FirstName% %LastName%.bat{ENTER}
Send, !fx
;Active the web brower. Need to be logged into the LinkStation before running script
WinWait, LinkStation,
IfWinNotActive, LinkStation, , WinActivate, LinkStation,
WinWaitActive, LinkStation
;Click on User Management
MouseClick, left, 135, 412
Sleep, 1000
StatusBarWait, Done
;Scroll to buttom of screen
Loop 15{
Send, {PgDn}
Sleep, 100
}
;Hit Add Local User button
Send, {SHIFTDOWN}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{SHIFTUP}{ENTER}
Sleep, 1000
StatusBarWait, Done
;Select User Name box
Send, {TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}
Sleep, 500
Send, %UserName%{TAB}a{TAB}a{TAB}%Name%{TAB}{ENTER}
Sleep, 1000
StatusBarWait, Done
;Click Logout button
MouseClick, left, 135, 527
StatusBarWait, Done
Sleep, 7000
;Log back on
Send, admin{TAB}password{TAB}{ENTER}
StatusBarWait, Done
Sleep, 3000
;Click Shared Folders
MouseClick, left, 135, 347
Sleep, 500
;Scroll to bottom of page
Loop 15{
Send, {PgDn}
Sleep, 100
}
;Hit Add button
Send, {SHIFTDOWN}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{SHIFTUP}{ENTER}
Sleep, 1000
StatusBarWait, Done
;Select Shared Folder Name box
Send, {TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}
Sleep, 500
;Select desired options for share
;This particular string of keystrokes will put in the shared folder name and descritpion, uncheck the Apple Shared Folder Support (leaving just Windows), disable the Recyle Bin, enable Access Restrictions, give Group Read/Write access to a group called LocalAdmin that I created and give User Read/Write access to the most recently added user
Send, %ShareName%{TAB}%Name%{TAB}{TAB}{SPACE}{TAB}{TAB}{TAB}{TAB}{RIGHT}{TAB}{LEFT}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{DOWN}{DOWN}{DOWN}{SHIFTDOWN}{TAB}{TAB}{SHIFTUP}{ENTER}{SHIFTDOWN}{TAB}{TAB}{TAB}{SHIFTUP}{ENTER}
Send, {TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{PgDn}{PgDn}{PgDn}{PgDn}{PgDn}{PgDn}{PgDn}{PgDn}{PgDn}{PgDn}{PgDn}{PgDn}{PgDn}{PgDn}{PgDn}{Up}{Up}{SHIFTDOWN}{TAB}{TAB}{SHIFTUP}{ENTER}{SHIFTDOWN}{TAB}{TAB}{TAB}{SHIFTUP}{ENTER}
Send, {PgDn}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}
;Wait for changes to save
StatusBarWait, Waiting for
Sleep, 1000
StatusBarWait, Done
Sleep, 500
;Click Logout button
MouseClick, left, 135, 590
StatusBarWait, Done
Sleep, 7000
;Log back on
Send, admin{TAB}password{TAB}{ENTER}
}