Home arrow Howto's arrow Howto - Scripting
Home
Tools
Knowledge Center
Howto's
Latest Jobs
Latest jobs from IT Contractor Jobs
The latest jobs registered on the IT Contractor Jobs web site.
  • Business Analyst

    - Business Analyst (New Zealand, Wellington - Wellington CBD)

    Business Analyst Intermediate to senior level Business Analyst 6 months initial term Start ASAP..... Major financial services organisation requires an intermediate to senior level Business...

  • Desktop Engineer

    - Desktop Engineer (New Zealand, Auckland - Auckland CBD)

    Desktop Engineer We are looking for an experienced Desktop Engineer to provide on-site technical PC support.   The successful candidate will demonstrate the following experience and...

  • IT Support/ Helpdesk

    - IT Support/ Helpdesk (New Zealand, Christchurch - Christchu5rch CBD)

    IT Support/ Helpdesk - Contract Roles   My client is searching for a highly skilled allrounder to join their team at a time when...


Howto - Scripting
Practical Scripting Part 5: Getting Over the Hump PDF Print E-mail

In the previous article in this series we started exploring what we could do with the Win32_NetworkAdapterConfiguration class. This powerful WMI class has 61 properties and 41 methods that can be used for retrieving and changing TCP/IP networking settings on Windows computers.

To illustrate the power of this class, we took the sample script we developed in the first and second articles and, using information about this class on MSDN, we customized our original script to make it do something different. Specifically, we took a script that changed the IP address of a network adapter and customized it to come up with a new script that disables NetBIOS over TCP/IP (NetBT) on all network adapters that have TCP/IP bound and enabled on them.

We need to explore this powerful WMI class further, and we're going to do so in several future articles. But before we do this, let's talk about The Hump.

Read more...
 
Practical Scripting Part 6: Remote Scripting First Steps PDF Print E-mail

Let's go back to the script ChangeIPAddress.vbs that we developed to change the IP address of a network adapter:

Option Explicit
Dim objWMIService
Dim objNetAdapter
Dim strComputer    
Dim strAddress    
Dim arrIPAddress
Dim arrSubnetMask
Dim colNetAdapters
Dim errEnableStatic

If WScript.Arguments.Count = 0 Then
     Wscript.Echo "Usage: ChangeIPAddress.vbs new_IP_address"
     WScript.Quit
End If

strComputer = "."
strAddress = Wscript.Arguments.Item(0)
arrIPAddress = Array(strAddress)
arrSubnetMask = Array("255.255.255.0")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each objNetAdapter in colNetAdapters
     errEnableStatic = objNetAdapter.EnableStatic(arrIPAddress, arrSubnetMask)
Next

Read more...
 
Practical Scripting Part 4: Using Win32_NetworkAdapterConfiguration PDF Print E-mail

In the first two articles of this series we examined the basics of using Windows scripting to manage TCP/IP networking settings. In particular, we developed the following simple script to change the IP address of a network adapter:

Read more...
 
Practical Scripting Part 3: Understanding WMI PDF Print E-mail

In the first two articles of this series we saw how to change the IP address of a network adapter on a Windows computer using VBScript. Along the way we learned many of the basic concepts of Windows scripting such as classes, objects, properties, methods, and different types of variables including string variables, integer variables, arrays and collections. We also learned some of the basics of writing a good script such as defining variables, implementing error handling, accepting user input, displaying confirmation output, and documenting your script by adding comments.

Our final script worked as expected, but there may be some aspects of it you still find mysterious. For example, take a look at this particular line:

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

In my first article, I made the following comment concerning this particular line: "This connects you to the root\cimv2 namespace on the local computer by defining an object named objWMIService and setting it equal to the handle returned by the GetObject method."

What on earth does that mean? What's WMI and how does it work? And why is it important to learn about if you want to learn how to write scripts to administer Windows computers?

Read more...
 
Practical Scripting Part 2: Cleaning Up PDF Print E-mail

Last month I began a new series of articles here on WindowsNetworking.com intended to demonstrate how to manage different aspects of Windows networks using scripts. The first article introduced some basic scripting concepts like objects, methods, and properties, and the goal of the article was to write a simple script that changed the IP address assigned to your network adapter. Here's what we came up with for our first script, which we called ChangeIPAddress.vbs:

strComputer = "."
arrIPAddress = Array("172.16.11.99")
arrSubnetMask = Array("255.255.255.0")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration")
For Each objNetAdapter in colNetAdapters
     errEnableStatic = objNetAdapter.EnableStatic(arrIPAddress, arrSubnetMask)
Next

When I ran this script on my Windows server, it successfully changed the IP address of the machine from .45 to .99 as could be seen by running ipconfig before and after running the script. So far, so good.

Unfortunately, while the above script works, it's kind of "messy" as it's missing certain things that well-written scripts should have such as variable definitions, error handling, use input, and confirmation output. So let's "clean up" our script by adding these elements, and along the way we'll learn more about the basics of Windows scripting

Read more...
 
<< Start < Prev 1 2 3 4 Next > End >>

Results 19 - 27 of 29
Powered by IT CONTRACTORS and designed by EZPrinting web hosting