Jump to content

Connecting Windows 7 Laptops to new WiFi and disconnect from the old WiFi


Recommended Posts

Posted

Hi

 

Currently all our staff laptops ( Windows 7) are connected to old wireless network..

Now we have implemented new wireless network . The Wi-Fi Security profile for the new Wi-Fi network is WPA2-Personal with AES encryption.

 

All the staff Laptops are in a particular OU. Now when users power on their laptop, I would like their laptop to connect to the new wireless network, disconnecting the old wireless network,

 

We don't have radius server at the moment.

 

Please let me know if there is a way of achieving this through scripting \GPO

Thanks and any help would be great

Posted

Your laptops will need to be hardwired in

 

 

You will need to create a startup script which will delete the wlan, shutodown your machine and then create a new wlan import file which connects to your new network

 

 

This will help you delete your profile How to Delete WiFi Networks From the Command Line in Windows 8

 

This will help to export your new wlan settings to an xml netsh wlan export profile %SSIDName% folder=c:\temp

 

 

This is the command line to add wlan profile in netsh wlan add profile "\\Domain.local\netlogon\WLAN\Wi-Fi.xml"

 

Hope this helps

Posted

Thanks that would be great!

 

"we had a script that pushed out a new SSID a week or so before and then when we turned the old ones off it was ready to go. I'll see if I can find it for you. "

 

Do I still need to still ask the staff to connect their laptops to the LAN for this change.

Posted

Do it with group policy:

 

Open the Active Directory GPO in the Group Policy Object Editor.

Expand Computer Configuration, Windows Settings, Security Settings, and then click Wireless Network (IEEE 802.11) Policies.

Right-click Wireless Network (IEEE 802.11) Policies and then click Create A New Windows Vista Policy. The Wireless Network Properties dialog box appears.

To add an infrastructure network, click Add and then click Infrastructure to open the Connection tab of the New Profile Properties dialog box. In the Network Names list, click NEWSSID and then click Remove. Then, type a valid internal SSID in the Network Names box and click Add. Repeat this to configure multiple SSIDs for a single profile. If the network is hidden, select the Connect Even If The Network Is Not Broadcasting check box.

On the New Profile Properties dialog box, click the Security tab. Use this tab to configure the wireless network authentication and encryption settings. Click OK.

 

https://technet.microsoft.com/en-us/magazine/gg266419.aspx

Posted

NETSH WLAN is definitely the way to go.

 

Initially when joining the domain, your workstation needs to be connected to receive the wireless profile.

 

Afterwards, you can do it wirelessly as follows -

 

Keep your old wireless network online, and use the NETSH WLAN command in a Startup script. In a few days, check a few devices manually to check it has received the new wireless profile.

 

Once you're confident it's worked, over night switch off the old wireless network and enable the new wireless network. Clients should then connect to the new network automatically, providing the security details are identical.

 

I've done this numerous times and it works well. Optionally afterwards, use NETSH WLAN to delete the old wireless profile name, but in saying that, it is optional and not required.

Posted

OK, basically you need to export the wireless profile from one working machine first using:

 

Netsh wlan export profile New-SSID folder=c:\temp

 

Save the exported XML file to a network share. Then create a logon script using a method similar to this:

@echo off

if exist "c:\temp\NewWiFi.txt" goto end

 

if not exist "c:\temp\New-SSID.xml" copy "\\server\share\New-SSID.xml" "c:\temp" /y

netsh wlan add profile filename="c:\temp\New-SSID.xml” user=all

echo >c:\temp\NewWiFi.txt

del "c:\temp\New-SSID.xml /y

 

:end

Posted

Hi

 

I am not clear with the NewWiFi.txt" , what values I need to put in this txt file.

 

if exist "c:\temp\NewWiFi.txt"

 

 

Also on the below, do I need to put the OLD Wi-Fi SSID to delete the old wireless network.

del "c:\temp\New-SSID.xml /y

Posted
Hi

 

I am not clear with the NewWiFi.txt" , what values I need to put in this txt file.

 

if exist "c:\temp\NewWiFi.txt"

 

echo >c:\temp\NewWiFi.txt

 

This part creates the NewWiFi.txt for you after the script has run the main part. If it already exists the profile must be installed, so the script doesn't run.

 

Also on the below, do I need to put the OLD Wi-Fi SSID to delete the old wireless network.

del "c:\temp\New-SSID.xml /y

 

This just clears up the new xml once it's stored. If you have to get rid of the old one you need to add in a separate line, I'd try it before the "echo >c" line. Though I'd err on the side of caution and leave it there just in case - at least there's a fallback if it is still in use.

 

netsh wlan delete profile name="[PROFILE NAME]"

Posted (edited)

Hi

 

I created a StaWireless.VBS file with the following information on it and went to the Staff GPO - User Configuration-policies- windows settings- Script- Logon and added this "Stawireless.vbs" file and i get an error which pops up when users logs in.Please help if i am making mistake any where.

Thanks

 

@echo off

if exist "c:\temp\NewWiFi.txt" goto end

 

if not exist "c:\temp\BC-Staff.xml" copy "\\Fserver-a\WAP\BC-Staff.xml" "c:\temp" /y

netsh wlan add profile filename="c:\temp\BC-Staff.xml” user=all

echo >c:\temp\NewWiFi.txt

del "c:\temp\BC-Staff.xml /y

 

 

 

Error:

 

Windows Script Host

 

"Script: \\DC1\netlogon\stafflogin.vbs

Line:1

Char:1

Error:Invalid character

Code:800A0408

Source: Microsoft VBScript compilation error"

 

The Stafflogin.vbs is the file specified on the Active Directory - user properties-Profile- User profile- Logon Script-Stafflogin.vbs

Edited by genesis
Posted (edited)
Hi

 

I created a StaWireless.VBS file

 

I use it as .bat. Here's mine. I don't copy the xml to a local path and then delete it, but it still seems to work. Probably also bad form to drop the "check run" in C:\. Why not grab a laptop, delete the wireless profile (if necessary) and test the .bat on it before you try to deploy?

 

@echo off

IF EXIST "c:\Wireless.txt" GOTO :END

netsh wlan add profile filename="\\dc-01\NETLOGON\WirelessSettings\NewWireless.xml" user=all

echo >>"c:\Wireless.txt"

:END

EXIT

Edited by LeMarchand
Posted

Hi

I created a .bat file from the above code and ran the batch file from a laptop that was connected to the old WiFi network and it successfully disconnected from the old WiFi and connected to the new WiFi, which is great.

 

To make sure it works , i deleted the wireless.txt from C: ,remove the new WiFi for the manage wireless and connected to the old Wifi and ran the batch file from the desktop to see if it connects top the new wifi and it is not connecting.

Do i need to add any additional script.

thanks

Posted

Export the wireless profile (the XML file) again but this time specify key=clear, e.g.

 

netsh wlan export profile key=clear

 

otherwise other computers won't be able to import the profile because the Wireless key will be encrypted. Be aware the XML file will have your keys completely in the open.

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



×
×
  • Create New...