Win7: netsh Commands For Network Interface Settings via CLI

Dos Shell Script

@echo off
echo This script must be ran as ADMIN
set ipAddr=192.168.0.81
set subMask=255.255.255.0
set gwAddr=192.168.0.1
set dns=dhcp
set dnsAddr=208.180.42.68

echo %COMPUTERNAME% - %ipAddr% - %subMask% - %gwAddr% - %dnsAddr%
echo Setting inferace values now... CTRL-C to cancel
pause
netsh interface ip set address name="Local Area Connection" static %ipAddr% %subMask% %gwAddr%
netsh interface ip set dns "Local Area Connection" source=dhcp

netsh Commands

Show if config

netsh interface ip show config

Set if to static

netsh interface ip set address name="Local Area Connection" static 192.168.0.81 255.255.255.0 192.168.0.1

Set DNS for DHCP

netsh interface ip set dns "Local Area Connection" source=dhcp

Set DNS to static value

netsh interface ip set dns "Local Area Connection" static 208.180.42.68 primary
netsh interface ipv4 add dnsservers "Local Area Connection" address=208.180.42.68 index=1

Set if to DHCP

netsh interface ip set address name="Local Area Connection" dhcp

WINS for static ip

netsh interface ip set wins "Local Area Connection" static 192.168.0.200

Dump settings

netsh -c interface dump > c:location1.txt

Load Settings

netsh -f c:\location2.txt

Allow Remote Connections to webservice / application ports

netsh http add urlacl url=http://*:49291/ user=everyone

netsh http add urlacl url=http://*:49294/ user=everyone

 

 

References


add urlacl

Reserves the specified URL for non-administrator users and accounts. The discretionary access control list (DACL) can be specified by using an account name with the listen and delegate parameters or by using a security descriptor definition language (SDDL) string.

syntax
add urlacl [url=]string
           [[user=]string
           {[[listen={yes|no}] [delegate={yes|no}]] | [sddl=]string}

 

Parameters

**[url=]**string

Specifies the fully qualified URL.

**[user=]**string

Specifies the user or user group name.

[listen={yes|no}]

Specifies one of the following values:

  • yes: Allows the user to register URLs. This is the default value.
  • no: Denies the user from registering URLs.

[delegate={yes|no}]

Specifies one of the following values:

  • yes: Allows the user to delegate URLs.
  • no: Denies the user from delegating URLs. This is the default value.

**[sddl=]**string

Specifies the SDDL string that describes the DACL.

Examples

add urlacl url=http://+:80/MyUri user=DOMAIN\user

add urlacl url=http://www.contoso.com:80/MyUri user=DOMAIN\user listen=yes

add urlacl url=http://www.contoso.com:80/MyUri user=DOMAIN\user delegate=no


 

 

 

Tags