The value of Scripting

If you are scared of scripts and scripting processes, maybe this will adjust your feelings...

In a previous life I managed a a series of Unix based backup disk and tape systems for a large enterprise.  What Fun!!!  I had had a fair amount of scripting experience at the time writing batch files and vbs/js scripts before that at various positions to make my daily/weekly/monthly tasks more interesting and less redundandt.  Specifically, and most elaborately I wrote a script to build and analyze an excel spreadsheet with data populated from event logs.  It was quite elaborate and involved some command lines to dump the event logs and then some vba to get the flat files into excel and then creat some sorting and charting...later I redid that to dump into an SQL DB and then read with excel and chart that in a more real-time situation.  On the Unix systems I learned a ton about cron and bash shell scripting.  It was alot more fun to do that than to log into to like a dozen servers and run a series of commands.

Back on topic...so we've had a bit of ice this weekend and today a client is wanting to work from home, but the desktop is not allowing her to log in through RWW...WHY DID I BUY THIS IF I CAN'T DO THIS???  So I get onto the server's console and start pinging the desktop, it's up...  So then I try to connect using RDP, nuttin'...hum...I try to access the admin shares c$, etc, nuttin'...k, so this ain't right.  After several attempts to 'manage' the desktop, all failing, I turn to the Script Center.  If you don't know about this, get to know about it...

http://www.microsoft.com/technet/scriptcenter/

While looking around I found the solution to my problems...

http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true click on Desktop Management -> Startup and Shutdown and there it is...Restart a Computer...  So the 'sample' has a fictisious machine name, but substitute the target desktop...

I plugged that script, properly edited for the traget machine into a .vbs file ran it from the command line with cscript.  In another cmd window launched the old ping -t computername watched it go down then come back up...  tried RDP, it werked for me, so I emailed the customer and told her to try it out...sure enough it werked...

Some other tools that may have come in handy had I wanted to use it...running shutdown /i from a cmd line will sometimes do it.  You may want to try the pstools if you have a service providers lic. (I am still not sure about the lic. since microsoft bought sysinternals...)http://www.sysinternals.com

I have some improvements on tap though...first will be to prompt you for the remote computer name, perhaps with a 'browse' feature...also wrap it in a nice hta GUI, that maybe will ping and report when the remote machine is back up and maybe start an RDP Session for testing...

Comments

# SqlServerForum.org » Blog Archive » The value of Scripting

Tuesday, February 06, 2007 3:34 PM by SqlServerForum.org » Blog Archive » The value of Scripting

Leave a Comment

(required) 
(required) 
(optional)
(required)