f



windows scripting help needed.

Hi i wana some help on windows scripting i want to run the script that
changes the ip address and the MAC ADDRESS that's the network address
on the excution of the script i have found the script that can edit ip
address automaticaly but i cant find out the script to change MAC
ADDRESS. below i have provided the script for changing the ip on it's
execution can any one add the string for changing or ADDING and MAC
ADDRESS where ther's no value specified such as option is NOT PRESENT.

The Script below
Sets the IP address of a computer to 192.168.1.141, and sets the IP
gateway to 192.168.1.100.
I Want to Set the MAC ADDRESS to "XXXXXXXXXX" form not present.
can any one help me out.

=== Script =================================================================
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where
IPEnabled=TRUE")
strIPAddress = Array("192.168.1.141")
strSubnetMask = Array("255.255.255.0")
strGateway = Array("192.168.1.100")
strGatewayMetric = Array(1)
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
If errEnable = 0 Then
WScript.Echo "The IP address has been changed."
Else
WScript.Echo "The IP address could not be changed."
End If
Next
0
mraltaf (2)
12/19/2003 5:30:37 AM
comp.programming 11491 articles. 2 followers. Post Follow

4 Replies
388 Views

Similar Articles

[PageSpeed] 17

use c++ >.<
0
irlegit (2)
12/19/2003 5:50:14 AM
Alien wrote:
> Hi i wana some help on windows scripting i want to run the script that
> changes the ip address and the MAC ADDRESS that's the network address
> on the excution of the script i have found the script that can edit ip
> address automaticaly but i cant find out the script to change MAC
> ADDRESS. below i have provided the script for changing the ip on it's
> execution can any one add the string for changing or ADDING and MAC
> ADDRESS where ther's no value specified such as option is NOT PRESENT.
> 
> The Script below
> Sets the IP address of a computer to 192.168.1.141, and sets the IP
> gateway to 192.168.1.100.
> I Want to Set the MAC ADDRESS to "XXXXXXXXXX" form not present.
> can any one help me out.
> 
> === Script =================================================================
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
> "\root\cimv2")
> Set colNetAdapters = objWMIService.ExecQuery _
> ("Select * from Win32_NetworkAdapterConfiguration where
> IPEnabled=TRUE")
> strIPAddress = Array("192.168.1.141")
> strSubnetMask = Array("255.255.255.0")
> strGateway = Array("192.168.1.100")
> strGatewayMetric = Array(1)
> For Each objNetAdapter in colNetAdapters
> errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
> errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
> If errEnable = 0 Then
> WScript.Echo "The IP address has been changed."
> Else
> WScript.Echo "The IP address could not be changed."
> End If
> Next

I suppose you want to alter the hardware configuration, not spoof 
packets.  I am unaware of a method to alter MAC of the Nic card.  I 
frequently use NetSh.EXE, http://www.ss64.com/nt/netsh.html, to set 
these parameters.  I don't believe even the MS utility can alter the MAC 
address, but perhaps a method will show itself be researching more into 
the use of this command.

0
jdionne (224)
12/19/2003 3:00:44 PM
Joseph Dionne wrote:
> Alien wrote:
> 
>> Hi i wana some help on windows scripting i want to run the script that
>> changes the ip address and the MAC ADDRESS that's the network address
>> on the excution of the script i have found the script that can edit ip
>> address automaticaly but i cant find out the script to change MAC
>> ADDRESS. below i have provided the script for changing the ip on it's
>> execution can any one add the string for changing or ADDING and MAC
>> ADDRESS where ther's no value specified such as option is NOT PRESENT.
>>
>> The Script below
>> Sets the IP address of a computer to 192.168.1.141, and sets the IP
>> gateway to 192.168.1.100.
>> I Want to Set the MAC ADDRESS to "XXXXXXXXXX" form not present.
>> can any one help me out.
>>
>> === Script 
>> =================================================================
>> strComputer = "."
>> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
>> "\root\cimv2")
>> Set colNetAdapters = objWMIService.ExecQuery _
>> ("Select * from Win32_NetworkAdapterConfiguration where
>> IPEnabled=TRUE")
>> strIPAddress = Array("192.168.1.141")
>> strSubnetMask = Array("255.255.255.0")
>> strGateway = Array("192.168.1.100")
>> strGatewayMetric = Array(1)
>> For Each objNetAdapter in colNetAdapters
>> errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
>> errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
>> If errEnable = 0 Then
>> WScript.Echo "The IP address has been changed."
>> Else
>> WScript.Echo "The IP address could not be changed."
>> End If
>> Next
> 
> 
> I suppose you want to alter the hardware configuration, not spoof 
> packets.  I am unaware of a method to alter MAC of the Nic card.

It's prohibitively difficult on most platforms, but it's not hard (to 
fake) on Linux.

> I 
> frequently use NetSh.EXE, http://www.ss64.com/nt/netsh.html, to set 
> these parameters.  I don't believe even the MS utility can alter the MAC 
> address, but perhaps a method will show itself be researching more into 
> the use of this command.
> 

0
Jeffrey
12/19/2003 3:10:13 PM
Joseph Dionne wrote:
> Alien wrote:
> 
>> Hi i wana some help on windows scripting i want to run the script that
>> changes the ip address and the MAC ADDRESS that's the network address
>> on the excution of the script i have found the script that can edit ip
>> address automaticaly but i cant find out the script to change MAC
>> ADDRESS. below i have provided the script for changing the ip on it's
>> execution can any one add the string for changing or ADDING and MAC
>> ADDRESS where ther's no value specified such as option is NOT PRESENT.
>>
>> The Script below
>> Sets the IP address of a computer to 192.168.1.141, and sets the IP
>> gateway to 192.168.1.100.
>> I Want to Set the MAC ADDRESS to "XXXXXXXXXX" form not present.
>> can any one help me out.
>>
>> === Script 
>> =================================================================
>> strComputer = "."
>> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
>> "\root\cimv2")
>> Set colNetAdapters = objWMIService.ExecQuery _
>> ("Select * from Win32_NetworkAdapterConfiguration where
>> IPEnabled=TRUE")
>> strIPAddress = Array("192.168.1.141")
>> strSubnetMask = Array("255.255.255.0")
>> strGateway = Array("192.168.1.100")
>> strGatewayMetric = Array(1)
>> For Each objNetAdapter in colNetAdapters
>> errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
>> errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
>> If errEnable = 0 Then
>> WScript.Echo "The IP address has been changed."
>> Else
>> WScript.Echo "The IP address could not be changed."
>> End If
>> Next
> 
> 
> I suppose you want to alter the hardware configuration, not spoof 
> packets.  I am unaware of a method to alter MAC of the Nic card.  I 
> frequently use NetSh.EXE, http://www.ss64.com/nt/netsh.html, to set 
> these parameters.  I don't believe even the MS utility can alter the MAC 
> address, but perhaps a method will show itself be researching more into 
> the use of this command.
> 

Windows does allow reading, and altering, this information, however 
support began at Windows 2000, and requires the DDK.

http://www.osr.com/ddk/network/103ndisx_7b76.htm

But, as I suspected, support for altering MAC is provided by the Nic 
manufacture.  From the article below, not all adapters allow altering MAC.

http://compnetworking.about.com/library/weekly/aa062202c.htm

"Starting with Windows 2000, users can change their MAC address through 
the Windows My Network Places interface. This feature relies on software 
support built into the adapter driver program and thus does not work for 
all adapters."

0
jdionne (224)
12/19/2003 3:11:46 PM
Reply: