Posted by: Tskyers
Storage conferences, Storage tips
My name is Tory Skyers. Through circumstances not entirely beyond my control (!!) I have been deeply involved throughout my career in various types of centralized and distributed storage. Now, at the end of a long chain of events beginning in Long Beach, CA with Curtis Preston and some blinky magnets (I’ll let you use your imagination), I’ve been offered an opportunity to share some of my experiences and insight with you.
I’ve been agonizing for a week on what to say for my first Blog. I think it has to be earth-shatteringly profound, so of all the catchphrases and tag lines I came up with, this seemed to sum it all up best:
Hello and thanks for reading my Blog.
What do you think? Just imagine a guy smiling ear to ear and waving at you from behind his keyboard .
An admission: I’m absolutely fascinated by storage. The technology that goes into connecting computers and people to storage today was the stuff of science fiction 20 years ago. Pause for a second and take a look at where we are in storage: 1 TB hard drives, 55GB optical discs, 10Gb Ethernet, 4Gbps Fibre Channel, 3 millisecond seek times, 300MBps throughput… all these numbers add up to wow, at least to me. When I think about all the technology out there, I feel like that kid at the toy store window with my eyes the size of saucers, staring at the GI Joe with the Kung-Fu grip, and the Spiderman Hotwheels set.
Here in my little corner of cyberspace I’ll be blogging about some of those stare-inducing storage technologies from my perspective, which is that of a network administrator (and according to friends is sometimes “warped and twisted” by my own particular brand of logic. I’ll also be touching on the ennui (SAT word I’ve been dying to use in a sentence) that I see creeping into the market. Check back from time to time and let me know if you agree with me. (And dig out that old SAT prep book while you’re at it–send me a word or two I’ll see if I can roll it in.)
One last thing: I gave a presentation on mobile storage at the recent Storage Decisions show in New York, and at the end of the presentation I mentioned a few scripts I wanted to share with the attendees. Below is a copy-and-paste of a simple script using ADfind from Joeware.net to archive users’ home directories that no longer have Active Directory accounts. This script can certainly be more elegant so feel free to expand, expound and extend. There are a few things on the “to-do” list for it: first, make it self-contained and not need an input file (i.e., do the AD query using ADODB or something similar). Second, provide logic to validate permutations of a username or directory. Third, be a pretty HTA (HTML Application). I’m working on migrating this script to Powershell.
The code is below the jump. Copy it out using notepad (not wordpad) or some script editor and save it as a .vbs. Run it from the command line with an input text file with one username per line. You’ll need to insert specifics for your environment like domain names, etc.
Again, thanks for the read!
‘ VBScript Source File — Created with SAPIEN Technologies PrimalScript 4.0
‘ NAME: archive.vbs
‘ AUTHOR: Tory Skyers , None
‘ DATE : 06/19/2007
‘ COMMENT: Searches Active directory for usernames and moves the folder if it is not found
‘ You will need to create a text file w/ usernames; and you need adfind.exe somwhere in your path
‘ eg: username1
‘ Parts adapted from Windows 2000 magazine Septemeber 2003 issue crisis mode scripting article
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim Args, inputfile
‘Slashes break things in file names so let’s take them out
strdate = replace(date, “/”, “-”)
‘ Ask for a file on the command line , tell the user what to type
If wscript.arguments.count <> 1 Then
wscript.echo “Syntax is: fixmove.vbs ”
‘ Read the input filename into an Array
Set args = wscript.arguments
strinputfile = args(0)
‘ Create the file system objects to manipulate files and folders
Set objFSO = Createobject(“Scripting.FileSystemObject”)
‘ Read in the text file and create an array with it.
‘ Use a linebreak as the delimiter
Set ObjTextStream = objFSO.OpenTextFile(strInputFile, ForReading)
arrUsers = Split(objTextStream.ReadAll, vbCrlf)
‘ Make sure the stdout object is defined and create a shell object
Set StdOut = Wscript.StdOut
Set objShell = CreateObject(“Wscript.Shell”)
‘ Keep going in case of errors
‘On Error Resume Next
‘ Step through the array we created earlier
For Each strUser In arrUsers
‘ Execute the adfind (copyleft joeware.net)
Set objScriptExec = objShell.Exec (“adfind -b dc=fabrikam,dc=com -f ” & chr(34) & “(objectcategory=user)(samaccountname=” & struser & “)” & chr(34))
strResults = Lcase(objScriptExec.StdOut.ReadAll)
‘Define the error and success log
Set objError = Objfso.OpenTextFile(“e:\fileserver\archived\” & strDate & “error.txt”, 8, True)
Set objSuccess = Objfso.OpenTextFile(“e:\fileserver\archived\” & strDate & “sucess.txt”, 8, True)
‘Move the folder from one place to another
If InStr(strResults, “0 objects returned”) Then
objFSO.MoveFolder strUser, “e:\fileserver\archived”
‘ Write to the console and error logs.
WScript.Echo “User ” & struser & “NOT Found! Moving Folder”
objError.WriteLine( “User ” & struser & “NOT Found! Moving folder”)
WScript.Echo “User ” & struser & “Found, not moving folder”
objSuccess.WriteLine (“User ” & struser & “Found, not moving folder”)