EzDevInfo.com

netsh interview questions

Top netsh frequently asked interview questions

netsh, block all IP addresses in a text file?

Is there a way for me to import a .txt file (with IP addresses on each line) into Windows Firewall?

I want each of the IP addresses to be completely blocked. That would also provide an easy way to unblock an IP address in the .txt file later on (in combination with netsh).

I am currently using Peerblock but it tends to cause some load on the CPU sometimes.


Source: (StackOverflow)

Enabling or disabling NIC remotely with windows 2008

I've been trying to enable or disable a NIC on Windows 2003 Server from a Windows 2008 Server PC. After googling around a bit, the command should be something like this:

netsh -r remotecomputer interface set interface "interface name" disabled

But when I try it, I get this error: "The newname and enable/disable option for LAN interfaces is not valid when administrating a remote machine".

I have admin access on both systems, and they are on the same LAN.

Anybody knows the right way to do it?


Source: (StackOverflow)

Advertisements

Why do netsh ip delete commands run so slowly in Windows Server 2003?

So a coworker accidentally added an entire /20 (~4000 ips) to a Windows 2003 Server.

I generated a simple batch file with all the necessary lines to remove these IPs. The commands do work and remove the IPs as I want, but the problem is they take around 3 to 10 minutes to execute each line, and the CPU is staying > 90% utilization, svchost.exe and lsass.exe seem to be eating up the most cycles.

Anyone know why these netsh commands are taking so long to execute?

Example:

netsh interface ip delete address name="Local Area Connection" addr=10.10.150.24


Source: (StackOverflow)

How to redirect/route IP address to another IP address?

How to redirect/route an IP address to another IP address?

E.g.: 10.10.10.10 -> 20.20.20.20 and then when I type in 10.10.10.10 in my browser, it connects to 20.20.20.20.

Let's assume 10.10.10.10 and 20.20.20.20 are external IP addresses.


Source: (StackOverflow)

Trigger scan through netsh on win7

I used the following command to trigger scan on WiFi interface netsh wlan show networks. However I found that this command return Windows 7 scan result without sending them to the relevant WiFi driver.

Is there any command I should use to trigger scan to WiFi driver? Thanks


Source: (StackOverflow)

how can I add the http command to netsh?

In the msdn docs for ssl configuration, there's this command:

netsh http show sslcert

But on my machine (Server 03) I don't have httpcfg command (looked in many places), netsh doesn't have the http sub-command. How can I get the http sub-command to show up? I've tried using AddHelper with all the http*.dll's I could find. No luck.


Source: (StackOverflow)

netsh add profile returns "An attempt was made to load a program with an incorrect format."

Using netsh, I used the following command to add a wireless profile

add profile filename="c:\profiles\DLINK-Profile.xml" interface="D-Link DWA-125 N150"

All parameters are valid. But I get the error "An attempt was made to load a program with an incorrect format."

I know this error is related to OS architecture 64bit or 32 bit. But i'm not sure which program is not compatible.

I'm using Win7 64bit


Source: (StackOverflow)

Open a test TCP connection to a specified IP/Port

I'm looking for a tool that works across windows (xp through 7) that will allow me to open a TCP connection to a specified ip and port. This functionality used to exist in windows xp (netsh diag connect iphost ), but the Netsh diag commands seem to have been removed in vista/7. I've been looking around for something similar, and I've searched Super User, but I can't seem to find anything.

Something that's already built into windows would be ideal, but a small executable that does this (preferably command line, standalone executable).

Edit: I should have specified further. I'm familiar with Telnet and putty, and it is what I currently use, however, I'm in an environment where I have to guide non-technical users through troubleshooting very technical problems over the phone, without any form of remote access (sounds fun, right?). While telnet works, it doesn't explicitly state whether or not the TCP connection was successful; you have to look at the title bar and the contents of the terminal output, which, for some reason, seems to be impossible to users. I'm looking for something with a clear "TCP Connection completed successfully/failed" type response, if such a tool exists.

Edit #2: Thanks to everyone who answered. All suggestions were good, despite the fact that I didn't post as clear a question as I should have. Thanks for the help.


Source: (StackOverflow)

WIndows Hosted Network

I have created a hosted network in my windows7 system. The netsh wlan show hostednetwork command gives the output

Hosted network settings
-----------------------
    Mode                   : Allowed
    SSID name              : "rambo"
    Max number of clients  : 100
    Authentication         : WPA2-Personal
    Cipher                 : CCMP

Hosted network status
---------------------
    Status                 : Started
    BSSID                  : xx:xx:xx:xx:xx:xx
    Radio type             : 802.11n
    Channel                : 11
    Number of clients      : 1
        xx:xx:xx:xx:xx:xx        Authenticated

But I have forgot the password for this connection and after some googling I found the command netsh wlan refresh hostednetwork YourNewNetworkPassword. But on executing this command it get the error

C:\Users\user>netsh wlan refresh hostednetwork rambo123
Invalid value "rambo123" for command option "data".

Usage: refresh hostednetwork [data=]key

I have no idea what is wrong with this command.


Source: (StackOverflow)

Force refresh (re-scan) wireless networks from command line?

How can I force Windows to re-scan for available wireless networks from the command line?

(i.e. I'm looking for the command-line equivalent of pressing F5 on the GUI.)


Source: (StackOverflow)

Can't connect ad hoc network to Windows 8.1 Pro

I'm trying to connect to my ad hoc network through the command prompt with the the following command:

netsh wlan show network

... I get the following output:

SSID 3 : Range

Network Type : Adhoc
Authentication : WPA2-Personal
Encryption : CCMP

I am trying to connect using this:

netsh wlan connect Range

But I'm getting this error message:

The network specified by Profile "Range" is not available to connect

How can I connect to my network using netsh wlan connect?


Source: (StackOverflow)

How can I start hostednetwork on Windows 7?

When I type in admin console command to start hostednetwork netsh wlan start hostednetwork it gives me this: The hosted network couldn't be started. The group or resource is not in the correct state to perform the requested operation.

There is a hotfix from Microsoft but it didn't help me. Any advice?

C:\Users\Pirozek>netsh wlan show driver

Interface name: Wireless Network Connection 3

    Driver                    : D-Link AirPlus DWL-G520 Wireless PCI Adapter(rev
.B)
    Vendor                    : Atheros Communications Inc.
    Provider                  : Atheros Communications Inc.
    Date                      : 8.7.2009
    Version                   : 8.0.0.171
    INF file                  : C:\Windows\INF\oem108.inf
    Files                     : 2 total
                                C:\Windows\system32\DRIVERS\athrx.sys
                                C:\Windows\system32\drivers\vwifibus.sys
    Type                      : Native Wi-Fi Driver
    Radio types supported     : 802.11b 802.11g
    FIPS 140-2 mode supported : Yes
    Hosted network supported  : Yes
    Authentication and cipher supported in infrastructure mode:
                                Open            None
                                Open            WEP-40bit
                                Shared          WEP-40bit
                                Open            WEP-104bit
                                Shared          WEP-104bit
                                Open            WEP
                                Shared          WEP
                                WPA-Enterprise  TKIP
                                WPA-Personal    TKIP
                                WPA2-Enterprise TKIP
                                WPA2-Personal   TKIP
                                Vendor defined  TKIP
                                WPA2-Enterprise Vendor defined
                                Vendor defined  Vendor defined
                                WPA-Enterprise  CCMP
                                WPA-Personal    CCMP
                                WPA2-Enterprise CCMP
                                Vendor defined  CCMP
                                WPA2-Enterprise Vendor defined
                                Vendor defined  Vendor defined
                                WPA2-Personal   CCMP
    Authentication and cipher supported in ad-hoc mode:
                                Open            None
                                Open            WEP-40bit
                                Open            WEP-104bit
                                Open            WEP
                                WPA2-Personal   CCMP

Source: (StackOverflow)

netsh wlan add profile not importing encrypted passphrase

I exported a wireless network connection profile from a Windows 7 machine correctly connected to a WiFi network with a WPA-TKIP passphrase. The exported xml file shows the correct settings and a keyMaterial node which I can only guess is the encrypted passphrase.

When I take the xml to another Windows 7 computer and import it using netsh wlan add profile filename="WiFi.xml", it correctly adds the profile's SSID and encryption type, but a balloon pops up saying that I need to enter the passphrase.

Is there a way to import the passphrase along with all other settings or am I missing something about adding profiles?

Here is the exported xml with personal information removed:

<?xml version="1.0"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
    <name>[removed]</name>
    <SSIDConfig>
        <SSID>
            <hex>[removed]</hex>
            <name>[removed]</name>
        </SSID>
        <nonBroadcast>false</nonBroadcast>
    </SSIDConfig>
    <connectionType>ESS</connectionType>
    <connectionMode>auto</connectionMode>
    <autoSwitch>false</autoSwitch>
    <MSM>
        <security>
            <authEncryption>
                <authentication>WPAPSK</authentication>
                <encryption>TKIP</encryption>
                <useOneX>false</useOneX>
            </authEncryption>
            <sharedKey>
                <keyType>passPhrase</keyType>
                <protected>true</protected>
                <keyMaterial>[removed]</keyMaterial>
            </sharedKey>
        </security>
    </MSM>
</WLANProfile>

Any help or advice is appreciated. Thanks.

Update: It seems if I export the settings using key=clear, the passphrase is stored in the file unprotected and I can import the file on another computer without issue. I've updated my question to reflect my findings.


Source: (StackOverflow)

How do I enable my network connection using command prompt?

How do I enable my network connection using command prompt?

I've tried:

netsh interface set interface "Local Area Connection" ENABLE

But received this error:

An interface with this name is not registered with the router.

I know how to disable my network connection using ipconfig/release but when I try ipconfig/renew using command prompt it doesn't seem to be working either.


Source: (StackOverflow)

netsh hostednetwork issue

I try to get the Virtual Wifi Adepter working on Win 7 Professional. I want to share the wifi connection (I think it does work with cable connection) and I'm pretty sure that the network card should be able to do this, since its a Dell notebook from last year (Dell XPS 15 with Intel wifi adapter). So far I did the following:

1) Starting cmd.exe as admin

2) netsh wlan set hostednetwork mode=allow ssid=test key=testkey1 returns positive feedback (mode for the hosted network is allowed, SSID has been changed etc.)

3) netsh wlan show hostednetwork returns what I previously entered

4) netsh wlan start hostednetwork returns positive feedback (hosted network has been started)

5) In Control Panel\Network and Internet\Network and Sharing Center you can see that the PC is connected with a wifi network using the wifi adapter and with the test network using one of the two the virtual adapters

6) netsh wlan show hostednetwork returns an error (group or resource not in correct state for this action) and my mobile device does not find the proposed connection

I tried deleting/deactivating the two virtual network connections and deinstalling the two virtual wifi adapters in the device manager and rebooting. So far, I only read about the encountered error during the start command.

Any ideas how to fix that or how to start all over again in setting up the virtual wifi? This morning it worked, except for the shared internet which would be the next step. (but using an additional cable connection, which I will try out later tonight and let you know)

Cheers, Daniel


Source: (StackOverflow)