Jump to content

SOLVED:: hmmmm NETSH


devil270975

Recommended Posts

Hi y'all, there was a command in Vista that allowed to set a kind of domain name to your pc that allowed some kind of static address, it involved netsh i'm sure of that, but can i find the commands on google? CIF!!! does anybody know what they are??? any help would be greatly appreciated...

Lee...

Edited by devil270975
Link to comment
Share on other sites


I'm not sure what you're talking about as it's not very clear, but here are a few ideas.

Maybe you're talking about a user class in a DHCP scope that allows a specific device to grab DHCP lease, but with different options than your standard scope (such as DNS servers, and a diferent gateway) This would be in Windows Server, not in NETSH

You can use standard DHCP Reservations, also for Windows server, not in netsh.

You can set a DNS Suffix to your computer, or your network connection, not sure if you can control this with NETSH, but I believe you can through the registry.

You could also just set a static IP through NETSH

Are any of these what you're talking about?

Thanks, Luke.

Link to comment
Share on other sites

Why not read up on NETSH and tell us if that is what you are looking for.

http://ss64.com/nt/netsh.html

As for the "kinda domain name" do you mean your WorkGroup name ? You can do that very easy, just right click Computer > Properties > Change Settings and set your Workgroup that way.

Edited by MrJinje
Link to comment
Share on other sites

Yeah, not sure exactly what you mean. Netsh can set network configuration settings, but netsh can't do anything for a domain or computer name. Maybe you're talking about IPs and Firewall/location settings? If you could be a little more clear in what you're trying to achieve, we can try to help.

Link to comment
Share on other sites

Hi y'all, there was a command in Vista that allowed to set a kind of domain name to your pc that allowed some kind of static address, it involved netsh i'm sure of that, but can i find the commands on google? CIF!!! does anybody know what they are??? any help would be greatly appreciated...

Lee...

http://www.speedguide.net/read_articles.php?id=2574 is that what you are looking for?

Link to comment
Share on other sites

I wrote a vbscript that does most of the netsh stuff that way it will ask you what you want it also will do the domain stuff / wins etc

one of the tricks that I do with netsh is to get the network adapter and then change it based on the driver it's using.

for example the one that I have here is for hp nic teams.

dim stripaddr
dim strsubnet
dim strgateway
dim strdns1
dim strdns2
dim strdns3
dim strwins1
dim strwins2

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter where Name = 'HP Network Teaming Virtual Miniport Driver'")
For Each objItem in colItems
'Wscript.Echo "Net Connection ID: " & objItem.NetConnectionID
strnicname=objItem.NetConnectionID
next

'strnicname = objItem.NetConnectionID
'wscript.echo strnicname

Const NETWORK_CONNECTIONS = &H31&

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(NETWORK_CONNECTIONS)

Set colItems = objFolder.Items
For Each objItem in colItems
If objItem.Name = strnicname Then
objItem.Name = "Public Team"
End If
Next

stripaddr = InputBox("Please enter the IP address:","Enter IP Address for the Team", ip )
strsubnet = InputBox("Please enter subnetmask:","Enter Team subnetmask", subnet )
strgateway = InputBox("Please enter the default gateway:","Enter Team Default gateway", gateway )
'strdns1 = InputBox("Please enter the default first dns server:","Enter Dns Server1", strdns1 )
'strdns2 = InputBox("Please enter the default Second dns server:","Enter Dns Server2", strdns2 )
'strdns3 = InputBox("Please enter the default Third dns server:","Enter Dns Server3", strdns3 )
'strwins1 = InputBox("Please enter the first wins server:","Enter wins server 1", strwins1 )
'strwins2 = InputBox("Please enter the second wins server:","Enter Wins server2", strwins2 )

'stripaddr = "192.168.1.49"
'strsubnet = "255.255.255.0"
'strgateway = "192.168.1.1"
strdns1 = "1.1.1.1"
strdns2 = "1.1.1.1"
'strdns3 = "1.1.1.1"
strwins1 = "1.1.1.1"
strwins2 = "1.1.1.1"

strcommand = "netsh interface ip set address name=""Public Team"" source=static " & stripaddr & " " & strsubnet & " " & strgateway & " 1"
strcommand1 = "netsh interface ip set dns ""Public Team"" static addr="&strdns1&" register=PRIMARY"
strcommand2 = "netsh interface ip add dns ""Public Team"" addr="&strdns2&" index=2"
strcommand3 = "netsh interface ip add dns ""Public Team"" addr="&strdns3&" index=3"
strcommand4 = "netsh interface ip set wins name=""Public Team"" source=static addr="&strwins1&""
strcommand5 = "netsh interface ip add wins name=""Public Team"" addr="&strwins2&" index=2"

'WScript.Echo "Running command: " & strCommand
'WScript.Echo "Running command: " & strCommand1
'WScript.Echo "Running command: " & strCommand2
'WScript.Echo "Running command: " & strCommand3
'WScript.Echo "Running command: " & strCommand4
'WScript.Echo "Running command: " & strCommand5
set objshell = wscript.createobject("wscript.shell")
objshell.run ("%comspec% /c " & strcommand) ,0,true

set objshell = wscript.createobject("wscript.shell")
objshell.run ("%comspec% /c " & strcommand1) ,0,true

set objshell = wscript.createobject("wscript.shell")
objshell.run ("%comspec% /c " & strcommand2) ,0,true

set objshell = wscript.createobject("wscript.shell")
objshell.run ("%comspec% /c " & strcommand3) ,0,true

set objshell = wscript.createobject("wscript.shell")
objshell.run ("%comspec% /c " & strcommand4) ,0,true

set objshell = wscript.createobject("wscript.shell")
objshell.run ("%comspec% /c " & strcommand4) ,0,true

set objshell = wscript.createobject("wscript.shell")
objshell.run ("%comspec% /c " & strcommand5) ,0,true

'now to add the dns suffixes
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetCards = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where where Name = 'HP Network Teaming Virtual Miniport Driver'")

Set objNetworkSettings = objWMIService.Get("Win32_NetworkAdapterConfiguration")
arrDNSSuffixes = Array("somewhere.com", "somewhere.net", "yoursite.com", "another.com")
objNetworkSettings.SetDNSSuffixSearchOrder(arrDNSSuffixes)

'CODE 1 **************************
' Correctly sets IP, Subnet, DNS, Gateway

'On Error Resume Next

' WINS Section
' 0 : enable NetBIOS via DHCP
' 1 : enable NetBIOS
' 2 : disable NetBIOS

iNetBios = 1
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where where Name = 'HP Network Teaming Virtual Miniport Driver'")

' WINS Section
For Each objNetAdapter in colNetAdapters
objNetAdapter.SetTCPIPNetBIOS(iNetBios)
Next

Edited by Tripredacus
Please use code or codebox tags
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...