5

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

  • it is because your PC/Laptop is in Airplane mode – Mahsa Apr 7 '15 at 19:01
3
netsh wlan set hostednetwork mode=disallow 

will stop the service and remove the virtual port

1

@Daiel... There may be a number of issues contributing to your problem. Do not play the deletion game with the virtual router. You may have made a mistake with your configuration and this may bring up the issues. follow the following steps and you should be fine.

  • Run the command prompt as Administrator (elevated Prevellages)
  • type the follwing; netsh wlan stop hostednetwork
  • Wait a while and type netsh wlan start hostednetwork
  • Now go to your current internet connected connection and access the properties (could be either your LAN or Wi-Fi access)
  • Access the sharing tab from the property window that opens.
  • Select the option to allow other systems to connect to the internet through that connection
  • If you have a drop-down to select which network (usually WIN8 and WIN8.1 or WIN7) then make sure you select the option what comes with something like "Local Area Connection 2*". the number could be different in your case.
  • Apply it and choose Ok for everything else.

Now your connections should be shared. There will be no need for you to delete any thing and next time you wish to connect just type in the command prompt netsh wlan start hostednetwork

1

Ok. Sharing and using hostednetwork can be a stress. This is how i've done it.
Using command line and powershell to achieve needed goals.
Sure it could be achieved with powershell only but hey ... probably later.

Save the following (BATCH FILE) file as a *.bat. Change accordingly where it reads

YOURPATH\YOURFILE.ps1

Save the second file (PS1 FILE) with name you supplied in previous step

"YOURFILE.ps1"

Alter the first section of ps1 file and change adapters accordingly with your system

$wifi = "description='Broadcom 4313 802.11b/g/n'"
$ethernet = "description='Intel(R) 82577LC Gigabit Network Connection'"

You can get yours running the following command in powershell

Get-WmiObject win32_networkadapterconfiguration | select description

Its supposed to have only one connected interface either physical (ethernet) or wireless.

Run batch file as administrator.

Additionaly you can start the process from the windows explorer context menu for simplicity.
For that use the third file and save it as a reg and run it or alter manually from the sample
Needless to say that its necessary to alter where it reads

YOURPATH\BATCHFILE.bat

Enjoy. Cheers

-------------------------------------------- BATCH FILE

@echo off
echo Current Settings (netsh wlan show hostednetwork):
netsh wlan show hostednetwork | findstr -i status
rem echo               Current Settings
rem echo            ######################
rem echo .
echo SSID Name
netsh wlan show hostednetwork | findstr -i " ssid "
netsh wlan show hostednetwork setting=security
echo            ######################
echo            #                    #
echo            # Please select      #
echo            #                    #
echo            #   [E] Edit     #
echo            #   [S] Start    #
echo            #   [Q] Stop     #
echo            #   [V] View     #
echo            #                    #
echo            ######################
choice /C ESQV 
IF errorlevel 4 goto TetherView
IF errorlevel 3 goto TetherStop
IF errorlevel 2 goto TetherStart
IF errorlevel 1 goto TetherEdit
rem GOTO TetherEnd

:TetherEdit
echo "Please enter SSID:" 
set /p SSID=
echo "SSID Password"
set /p PassWord=
echo %SSID% %PassWord%
netsh wlan set hostednetwork mode=allow ssid=%SSID% key=%PassWord%
netsh wlan start hostednetwork
GOTO TetherEnd

:TetherStart
netsh wlan start hostednetwork
powershell -file YOURPATH\ICS-Control.ps1 enable
GOTO TetherEnd

:TetherStop
netsh wlan stop hostednetwork
powershell -file YOURPATH\ICS-Control.ps1 disable
GOTO TetherEnd

:TetherView
cls
netsh wlan show hostednetwork | findstr -i status
echo SSID Name
netsh wlan show hostednetwork | findstr -i " ssid "
netsh wlan show hostednetwork setting=security
echo Connected clients
arp -a | findstr -i 192.168.173 | findstr /V 255 | findstr /V 192.168.173.1
GOTO TetherEnd

:TetherEnd
@PAUSE

--------------------------------------------PS1 FILE

#Change accordingly
$wifi = "description='Broadcom 4313 802.11b/g/n'"
$ethernet = "description='Intel(R) 82577LC Gigabit Network Connection'"

#Doesnt change so no need to alter. Detects what interface is connected (should be only one)
$netAdapter = get-wmiobject win32_networkadapter -filter "netconnectionstatus = 2" | select netconnectionid, name, InterfaceIndex, netconnectionstatus 
if ($netAdapter.netconnectionid -cmatch "Wi-Fi"){$publicAdapter = $wifi} else {$publicAdapter = $ethernet}
$privateAdapter = "description='Microsoft Hosted Network Virtual Adapter'"

Function Var1ICSenable
{
    $virtualAdapter = Get-WMIObject win32_networkadapterconfiguration | where {$_.ServiceName -eq "vwifimp"} | % {$_.GetRelated('win32_networkadapter')} | Select -ExpandProperty Name
    $vars1 = $privateAdapter
    $Adapter0 = Get-WmiObject Win32_NetworkAdapterConfiguration -Filter $vars1 | select description
    $mAdapter3 = $Adapter0 -replace "@{description=",""
    $mAdapter3 = $mAdapter3 -replace "}","" 
    $mAdapter4 = "description='$mAdapter3'"
    $mAdapter5 = gwmi win32_networkadapter -Filter $mAdapter4 |select netconnectionid
    $mAdapter5 = $mAdapter5 -replace "@{netconnectionid=",""
    $global:mAdapter5 = $mAdapter5 -replace "}",""
}

Function Var2ICSenable
{
    $vars2 = $publicAdapter
    $Adapter1 = Get-WmiObject Win32_NetworkAdapterConfiguration -Filter $vars2 | select description
    $mAdapter = $Adapter1 -replace "@{description=",""
    $mAdapter = $mAdapter -replace "}","" 
    $mAdapter1 = "description='$mAdapter'"
    $mAdapter2 = gwmi win32_networkadapter -Filter $mAdapter1 |select netconnectionid
    $mAdapter2 = $mAdapter2 -replace "@{netconnectionid=",""
    $global:mAdapter2 = $mAdapter2 -replace "}",""
}

function EnableDisableICS
{

    $bFound = $FALSE

    $oNetSharingManager = new-object -comobject HNetCfg.HNetShare
     if ($oNetSharingManager -eq $null)
        {
            write-host "Unable to get the HNetCfg.HnetShare object."
            Exit
        }    
    if ($oNetSharingManager.SharingInstalled -eq $null)
        {
            write-host "Sharing is not available on this platform."
            Exit
        }

    $oConnectionCollection = $oNetSharingManager.EnumEveryConnection
    foreach ($oItem In $oConnectionCollection)
    {
        $EveryConnection = $oNetSharingManager.INetSharingConfigurationForINetConnection($oItem)
        $objNCProps = $oNetSharingManager.NetConnectionProps($oItem)
        If ($objNCProps.name -eq $sPrivateConnectionName)
        {
            $bFound = $True
            write-host "Setting ICS Private to " $bEnable " on connection: " $objNCProps.name
            If ($bEnable -eq "true")
                {
                    $EveryConnection.EnableSharing(1)
                }
            Else
                {
                    $EveryConnection.DisableSharing()
                }
        }
    }

    $oConnectionCollection = $oNetSharingManager.EnumEveryConnection
    foreach ($oItem In $oConnectionCollection)
    {
        $EveryConnection = $oNetSharingManager.INetSharingConfigurationForINetConnection($oItem)
        $objNCProps = $oNetSharingManager.NetConnectionProps($oItem)

        If ($objNCProps.name -eq $sPublicConnectionName)
        {
           $bFound = $True
           write-host "Setting ICS Public to " $bEnable " on connection: " $objNCProps.name
            If ($bEnable -eq "true")
            {
                $EveryConnection.EnableSharing(0)
            }
            Else
            {
                $EveryConnection.DisableSharing()
            }
        }
    }

    If ($bFound -eq $null)
    {
       write-host "Unable to find the connection " + $sPublicConnectionName
    }

}

Function EnableSharing
{
    #regsvr32 /s hnetcfg.dll

        # Variables to enable and disable ICS
        Var1ICSenable
        Var2ICSenable
        $global:firstICSvar = $global:mAdapter2
        $global:secondICSvar = $global:mAdapter5

    $benable = "true"
    $sPublicConnectionName = $global:firstICSvar
    $sPrivateConnectionName = $global:secondICSvar

    $mstr = $sPublicConnectionName + " " + $sPrivateConnectionName + " " + $bEnable
    EnableDisableICS $mstr
}

Function DisableSharing
{
    #regsvr32 /s hnetcfg.dll

        # Variables to enable and disable ICS
        Var1ICSenable
        Var2ICSenable
        $global:firstICSvar = $global:mAdapter2
        $global:secondICSvar = $global:mAdapter5

    $benable = "false"
    $sPublicConnectionName = $global:firstICSvar
    $sPrivateConnectionName = $global:secondICSvar

    $mstr = $sPublicConnectionName + " " + $sPrivateConnectionName + " " + $bEnable
    EnableDisableICS $mstr
    #write-host "TESTE" $mstr
}

    if ($args[0] -eq "enable"){EnableSharing}else{DisableSharing}

--------------------------------------------REG FILE

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\runas]
@="Tether (Hosted Network)"
"HasLUAShield"=""

[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\runas\command]
@="cmd.exe /c YOURPATH\BATCHFILE.bat"
  • What are you trying to do here? – Gabriel Fair Feb 17 '15 at 1:40
0

I had a similar issue. I'd created a Virtual WLan on my PC and couldn't delete it - spent hours on Google. If there is a NETSH command out there to delete WLANs I couldn't find it!

The only solution I found was to rename the SSID - yours is currently test - to something I knew I could find, e.g. DeletethisrogueWLAN, then I used Regedit and F3 to search, deleted the key in the registry, hit F5 to refresh the Network Connections screen, and it disappeared.

To be able to set this up in the first place you must be pretty technical but please be careful when deleting registry keys and export any keys before deleting (just in case).

Hope this helps!

Darren

0

<strike>I don't know if you already did, but you need to share your base WiFi connection. To do this go to network center (or how that is called in English win version) and then do right mouse button on your network adapter through which you are connected to the internet. Then settings, and then the sharing tab. Select wifi-host (I think that is the standard name) then do the netsh wlan set.... And then netsh wlan start hosted network. That is how I do this always.

I also had a problem with this group is not allowed access, and I think I have solved it with some problem in my ip-v4 connection but I'm not sure about that anymore. It might have also been something with my bridge, I don't know it (if I remember I will tell!).</strike>

Edit: I found it! It wasn't working secs ago, and now it is. Go to your device manager, and on top you will see view, and then select show hidden devices. Then go to the network tabs, and there should be a grey circle with a down arrow: Network adapter. Right-click and then click on enable/start/turn on (for me it's called 'inschakelen':), and then it works fine!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.