In the previous article in this series we looked at two remote scripting tricks, one from a helpful reader and the other from the recently published Windows Vista Resource Kit. In this article we’re going to look at two more scripting tips. First, another remote scripting trick from another of our readers. And second, a real-world example showing how to use the Windows Management Instrumentation Command-line (WMIC).
So you lost the password on your Cisco switch. Maybe the old administrator left or maybe you just haven’t used this switch in a while and don’t recall the password. No matter what the case, you need to change the password on the switch so you can create a new password. How do you do this on a Cisco switch? It is a little more difficult than a Cisco router. One important difference between resetting the password on a Cisco switch vs. a router is that you don’t use configuration registers to reset the password on the switch. Let me show you how it’s done.
In the last few articles we’ve learned about some of the concepts and issues surrounding remote scripting on Windows platforms. In this article we’ll describe two tricks relating to remote scripting using WMI scripts written in VBScript.
First, how about a tip from the Windows Vista Resource Kit? This Resource Kit is the book for IT pros who plan on deploying Windows Vista in mid- and large-sized enterprise networking environments, and I was privileged to be lead author on this project and have permission from Microsoft Press to share a few excerpts with you from this terrific book.
Many of us use switches every day but never really think about how they work. Whether you are studying to become a CCNA or just want to learn more about how a switch really functions, this article is for you.
Let’s recap what we’ve learned so far about remote scripting using WMI:
In Part 6 of this series we tried modifying our ChangeIPAddress.vbs script so we could use it to remotely change the IP address of a computer. Along the way we learned that we needed to use Group Policy to enable the Remote Administration exception in Windows Firewall on the target computer, otherwise the script wouldn’t work. Eventually we got the script to work but it also timed out and returned an error.
Then in Part 7 we discovered we could “work around” the error by adding On Error Resume Next to our script. But the script still timed out i.e. took a long time to finish running. I consulted some scripting gurus and we came up with a tentative explanation for the error, but to see whether the problem was more general we created a new script called ChangeGateway.vbs and when we ran this script remotely, it worked.
Finally in Part 8 we had a reader suggest a simple possible cause for our error: changing the IP address of the remote computer breaks the connection to the computer, causing the script to time out with an error. That sounded plausible, so we tried using Network Monitor 3.0 to see what was happening when we ran the script, and sure enough it looks like our network trace analysis confirmed the reader was right. Score one for our readers!
It’s time to step back a bit however and learn some of the technical details of remote scripting before we go any further. It’s all well and good to jump in and try things, but sometimes we hit a wall when we do this. Learning the fundamentals however can often help us avoid (or go around or maybe jump over) the wall. So let’s start doing that now.