WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Control Manager
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Changing Computer Name and Setting IP Address

Keywords: 	 cSetIPAddress	   Set IP Address

Question:

I want to do various things in the Network dialog, including specifying the computer name, and setting the IP address. Any sample code?

Answer:

Here's some code that gets you 3/4 of the way there.
AddExtender("wwctl34I.dll")

;Change Computer name
Snam="jupiter"
IntControl(76, Snam, 0, 0, 0)

;Change Ip Address
Run("rundll32.exe", "shell32.dll,Control_RunDLL netcpl.cpl")
netwnd=DllHwnd("Network")  
tabtitle="Configuration"
systabwnd=cWndByClass(netwnd,"SysTabControl")  
tabwnd=cSetTabItem(systabwnd,1)
identwnd=cWndByName(netwnd,tabtitle)	
listbx=cWndByID(identwnd,404)
response=cGetLBText(listbx)

response2=strreplace(response,@tab,@crlf)
;message("",response2)

response=strupper(response)
count=ItemCount(response,@tab)
;message("",count)

for i=1 to count
  theitem=ItemExtract(i,response,@tab)
  first3=StrSub(theitem,1,3)
  if first3=="TCP" 
    cSetLBItem(listbx,i)
	 TimeDelay(1)
	 SendkeysTo("Network", "!r")	 ;Launch Properties window
	 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	 ;and then do subsequent sendkeys here to set the IP address
	 ;using the magic function: cSetIPAddress
	 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~
 endif
next


Article ID:   W12513
Filename:   How to Set Various Network Properties including IP.txt
File Created: 2017:07:28:12:58:27
Last Updated: 2001:10:16:08:41:12