Managing Windows networks using scripts - Part 5: Overcoming challenges

Earlier in this series, we began to explore new things about the Win32_NetworkAdapterConfiguration class. This powerful WMI class has 61 properties and 41 methods, which can be used for querying and changing TCP / IP network settings on Windows machines. We will need to explore the powerful feature of this WMI class in

Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 1Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 1   Part 1: Basic concepts
Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 2Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 2   Part 2: Complete the script
Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 3Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 3   Part 3: Understanding WMI
Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 4Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 4   Part 4: Use Win32_NetworkAdapterConfiguration

Mitch Tulloch

Earlier in this series, we began to explore new things about the Win32_NetworkAdapterConfiguration class. This powerful WMI class has 61 properties and 41 methods, which can be used for querying and changing TCP / IP network settings on Windows machines.

To illustrate the powerful features of this class, we have used the part one and two element development template scripts, as well as exploited support information on MSDN to change the original script and perform some other functions. together. Specifically, changing the IP address of a network adapter and customizing to create new scripts can interrupt NetBIOS over TCP / IP (NetBT) on all network adapters with TCP / IP limits allowed on them.

We will need to explore more powerful features of this WMI class in some of the following articles. But before you do that, first talk about obstacles when learning scripts. Overcoming all obstacles and difficulties to know how to use scripts in Windows network administration.

Trouble

After starting this series, we received many questions from our readers: ' How can I learn the script? . Our first reaction is usually to show people some questions such as script books, articles, script discussion forums . Yes, this answer will be useful for those who want to specialize. mind catches its hands from the beginning and trains itself rigorously to acquire a skill. But that often makes people develop a very common psychology: Stumbling! Because you have to invest too much time and effort!

So what do we do to learn script skills? First of all, it seems quite funny, but if you want to learn, you have to be prepared to be prepared and prepared to listen enthusiastically! Most of the original Windows admins who wanted to learn about scripting encountered a mistake that immediately broke into the main problem. Then a psychological fear arises because of being flooded with too many problems that are not easy to grasp: non-independent concepts that bind and relate to each other. For example, you will not be able to really understand what the Property is if you do not catch the Method. And both properties and methods can only be clear if placed in the context of Class. But the class has to interpret it as Object (Object) and each object has its properties and methods! More precisely, Object Reference into an Instance of a Class must have Properties and Methods for you to read and manipulate. Sounds too confusing, isn't it?

We cannot spend up to three years learning each Attribute, Method associated with each WMI class that works in the Windows network. Or learn every aspect of the syntax of VBScript language just to be fully mastered about it. Previously, during the early years of college, I had to spend a lot of time studying Fortran, writing one program after another, first showing 10, then 100, then one Thousands of Fibonacci numbers, . So, with limited time, money and patience, plus the difficult elements of the nature of a large number of concepts in Windows scripting, administrators like us need What to do to overcome obstacles in script learning and make it useful at hand?

Fix all obstacles

Obviously there is no mysterious answer to that question, but some of the following methods can help you:

1. Break down the job : Pointing the gun to the sky will of course not be able to shoot the ground bird. So learning right away is not the way to start a problem. Set a goal for each stage, as this week you must write a script to query the Active Directory for the OU structure in a domain and display that structure in an HTML page for example. The next week learns new concepts, writing another script to illustrate them. Try to find available scripts, read them and edit them to make your own requests. In addition, even if you do not need to fully understand each line, each command on the script, try to aggregate them, creating a combined script that performs the desired function without even understanding the structure. structure inside it. It is also a way to learn scripts.

2. Focus on some of the central issues of scripting techniques : One of the biggest drawbacks to starting a problem is that we always want to know everything about all aspects of the problem. Therefore, when starting to learn about scripting, we often try to read the entire book from VBScript to the end. Needless to say you understand that it is a rigid reading. It's better to focus on a specific part, like the TCP / IP scripting tasks (which we focused on in this series) first. After mastering and mastering then move on to another topic.

3. Take the time to learn the basic concepts : Focus on certain key parts, but at the same time you also have to spend time learning the basic concepts of the problem. For example, how to enter information into the script using the run time parameter. Learn some simple SELECT command syntax. Learn some different types of variables. Learn some WMI classes. Learn how to use Properties and Methods for each class . You don't need to be an expert in all areas, but you need to master the basics so you can write a complete script instead of every little piece of it.

4. Write notes for what you learn : In the past, for a long time I had no results when learning about scripts, because its concepts are quite confusing. As you mentioned above, during my college years I got to know and learn procedural programming languages ​​like Fortran. They become deep in the mind making it difficult for me to switch to object-oriented languages ​​when they start to become popular (for Windows administrators), and when VBScript is developed from Visual Basic. So for a long time I was confused with Objects, Properties, Methods, Classes. They create a huge obstacle for me to be able to learn scripts. Certainly I can use someone else's script to write and if it's simple, I can change it, edit it a little more to make it work. But MSDN at that time was like a remote, strange country and WMI was a mysterious supernatural thing! And then I started writing captions. One day, I wrote a simple sentence: ' Attributes are things you can read, and methods are things you can do ', suddenly things become clear. I understand that problems and obstacles no longer exist. Other concepts are quickly captured and the path to scripting is no longer strange and too difficult.

5. Collect useful materials for reference and use : If you find a good book about the script, don't hesitate to buy it for reading and practice exercises (if any). In addition, you can refer to many things at the TechNet Script Center (which will be noted later in this series). Another useful way to learn is to participate in short-term training courses, group discussions, etc. Script documents are not lacking, even rich if you really want to learn about it. It is important that you will learn and practice it or not.

6. Practice, practice and practice : To learn any skill well requires you to be patient. Only doing it over and over again will create perfection. There will be many obstacles on the path to success and requires you to have determination and innocence to overcome them. Usually, you will learn more from a few hundred short scripts instead of writing some long and synthesized scripts. Therefore, set up and complete short assignments to perform a certain task. You will understand the problem faster.

7. Make it a passion or a hobby : Don't know how you are, but for me, learning is most effective when you're in a good mood. If you have some administrative tasks related to the script, then you must be interested in learning it. And, if you're really busy (and sometimes a network administrator is free), the easiest way is to have someone write your script. But if you consider script as a pleasure to explore, similar to golf, you will approach it quickly and do more than what you learn. And just like playing golf, playing chess, having friends playing with you is always more interesting. See if your colleagues or IT professional friends are interested in playing scripting. If so, share with them, learning will be more fun and effective.

Conclude

I wrote this article because I found many readers having a hard time and began to get frustrated after reading the first four parts of this series. Hopefully, what I have written here can help you overcome those obstacles and continue to learn more about scripting, a technique that is not easy to grasp but very useful in network administration. In the next section we will come back to explore the Win32_NetworkAdapterConfiguration class and see what can be done with it. At the same time, we will also learn some new concepts and review what was introduced in the previous sections. We will learn more about VBScript syntax and see what can be done to make the script more neat and useful. And then explore some other WMI classes, along with some advanced scripting topics like editing authentication information, writing remote scripting code, COM objects, WSF scripts . Besides some theory. Useful tool for writing scripts, but learning the first basic concepts is very important. It helps you gain a deeper understanding of each topic and therefore be more confident with your skills. I will also try to give you some exercises to complete the script you have built. And if you really want to learn about scripts, you need to do them yourself, don't just look and say: ' I can do it! . Much practice will help you write a perfect script. Therefore, do not forget the most important task is practice and practice.

Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 5Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 5 Part 6: The first steps for remote scripting
Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 6Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 6 Part 7: Troubleshooting errors
Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 7Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 7 Part 8: Remote script error handling with Network Monitor 3.0
Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 8Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 8 Part 9: Understanding remote control scenarios
Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 9Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 9 Part 10: Tricks of remote control scenarios
Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 10Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 10
Part 11: Other script tricks
Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 11Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 11
Part 12: Properties of the WMI class
Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 12Managing Windows networks using scripts - Part 5: Overcoming challenges Picture 12
Part 13: The script returns all values

5 ★ | 1 Vote