Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > Need Help : Setting default Gateway and subnet using WMI Remotely
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 1st May 23:06
bill
External User
 
Posts: 1
Default Need Help : Setting default Gateway and subnet using WMI Remotely


Can someone help me change the following code to change the subnet mask and
default gateway for the remote server, the subnet mask will be 255.255.252.0
and gateway will be X.X.14.1 , can someone change this funtion to that ?
Thanks in advance.
Function GetIP (strComputer)
On Error Resume Next


Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
If Err.Number Then
WScript.Echo vbCrLf & "Error # " & CStr( Err.Number ) & _
" " & Err.Description
Err.Clear
Syntax
End If

On Error GoTo 0

Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

For Each objNicConfig In colNicConfigs
For Each strIPAddress In objNicConfig.IPAddress
rsCompInfo.AddNew
rsCompInfo.Fields(1) = strComputer
rsCompInfo.Fields(2) = strIPAddress
rsCompInfo.Fields(3) = now
rsCompInfo.Update
rsCompInfo.MoveLast
IPID = rsCompInfo.Fields(0)
IPAddress = strIPAddress
Exit Function
Next
Next
rsComp.MoveNext
End Function
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666