Forum Discussion

Benoit5's avatar
Benoit5
Copper Contributor
Feb 15, 2024

Automatic wifi connection during kiosk session

Hello,

I have created an "attributed access" or kiosk session on a Windows 10.
The pc is in Wi-Fi wpa2 enterprise.
I'd like to be able to automatically connect the kiosk session to the Wi-Fi using a script that I'll run as a scheduled task.

I've tried :

@echo off
setlocal enabledelayedexpansion

set "profileFile=C:\Users\Public\Libraries\Wi-Fi-profile.xml"
set "ssid=myssid"
set "security=myaccunt"
set "password=mypassword"

echo Importing Wi-Fi profile...
netsh wlan add profile filename="%profileFile%"

echo Connecting to Wi-Fi...
netsh wlan connect name="%ssid%" ssid="%ssid%" interface="Wi-Fi" >nul

timeout /t 5 >nul

echo Sending username and password...
netsh wlan set profileparameter name="%ssid%" userIdentity="%username%" >nul
netsh wlan set profileparameter name="%ssid%" keyMaterial="%password%" >nul

echo Connected to Wi-Fi: %ssid%

:end

pause

The script works, but I'm not connected.
The profile import is correct, but I don't think the credentials can be transmitted.
Can you help?

6 Replies

    • Benoit5's avatar
      Benoit5
      Copper Contributor

      Alabamatom1963 

      Unfortunately, this link to a help page for managing pc kiosk from microsoft cloud from azur.

      I don't use this type of machine, but a local assigned mode (local kiosk mode).

      My problem is that the login and password are not injected by the :

       

      echo Sending username and password...
      netsh wlan set profileparameter name="%ssid%" userIdentity="%username%" >nul
      
      netsh wlan set profileparameter name="%ssid%" keyMaterial="%password%" >nul 

       

       
  • This was generated using Windows CoPilot. It gives you some direction for creating the script and deploying it. Certainly! To automatically connect your kiosk session to a specific Wi-Fi network when you enable it, you can create a script and set it up as a scheduled task. Here's an example using a batch script: 1. **Create a Batch Script**: - Open a text editor (such as Notepad) and create a new file. - Add the following lines to the file, replacing placeholders with actual values: ```batch @echo off setlocal enabledelayedexpansion set "profileFile=C:\Users\Public\Libraries\Wi-Fi-profile.xml" set "ssid=YourSSID" set "security=WPA2-Enterprise" set "password=YourPassword" echo Importing Wi-Fi profile... netsh wlan add profile filename="%profileFile%" echo Connecting to Wi-Fi... netsh wlan connect name="%ssid%" ssid="%ssid%" interface="Wi-Fi" >nul echo Sending username and password... netsh wlan set profileparameter name="%ssid%" userIdentity="%username%" >nul netsh wlan set profileparameter name="%ssid%" keyMaterial="%password%" >nul echo Connected to Wi-Fi: %ssid% :end pause ``` - Save the file with a `.bat` extension (e.g., `ConnectToWiFi.bat`). 2. **Set Up a Scheduled Task**: - Press `Win + R`, type `taskschd.msc`, and hit Enter to open Windows Task Scheduler. - In the left pane, click on "Task Scheduler Library." - Click "Create Basic Task" in the right pane. - Follow the wizard: - Give your task a name (e.g., "AutoConnectToWiFi"). - Choose "When I log on" as the trigger. - Select "Start a program" as the action. - Browse and select the batch script you created earlier. - Complete the wizard by specifying any additional settings (e.g., delay, repeat intervals). - Save the task. 3. **Test the Scheduled Task**: - Log off and log back in to test if the script runs automatically and connects to the specified Wi-Fi network during startup. - The task will execute each time you log in, ensuring automatic Wi-Fi connection for your kiosk session. Remember to adjust the script with your actual Wi-Fi network details. If you encounter any issues or need further assistance, feel free to ask! 🌐:link: Source: Conversation with Bing, 4/18/2024 (1) Automatic wifi connection during kiosk session. https://techcommunity.microsoft.com/t5/windows-management/automatic-wifi-connection-during-kiosk-session/td-p/4057807. (2) Script required to automatically connect to specific Wi-Fi network .... https://www.tenforums.com/network-sharing/175422-script-required-automatically-connect-specific-wi-fi-network.html. (3) Deploy a Windows 10 multi-app kiosk with Microsoft Endpoint ... - 4sysops. https://4sysops.com/archives/deploy-a-windows-10-multi-app-kiosk-with-microsoft-endpoint-manager-configuration-manager-memcm-and-powershell/.
    • Benoit5's avatar
      Benoit5
      Copper Contributor

      Alabamatom1963 

      Hello,

      I've already tried to find a solution via AI (chat gpt, gemini, copilot) but it can't find a better script than mine.

      As proof, you write exactly the same thing as me, but without answering my question.

      Your answer is unfortunately useless.

      I'll keep hoping. Thank you anyway.

Resources