Adding a WIFI profile in MDT task sequence

KarathIT 80 Reputation points
2024-06-20T17:17:18.1366667+00:00

Hello,

How can a WIFI profile be added in an MDT task sequence to build a Windows 10/11 device? Is there a script or other option available to configure and add these settings in MDT?

Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,479 questions
Microsoft Deployment Toolkit
Microsoft Deployment Toolkit
A collection of Microsoft tools and documentation for automating desktop and server deployment. Previously known as Microsoft Solution Accelerator for Business Desktop Deployment (BDD).
902 questions
0 comments No comments
{count} votes

Accepted answer
  1. Erik Moreau 741 Reputation points MVP
    2024-06-20T18:22:38.43+00:00
    # PowerShell script to add a WiFi profile during MDT deployment task sequence
    # Define the path to the XML file containing the WiFi profile settings
    
    $wifiProfilePath = "C:\\DeploymentShare\\Profiles\\YourWiFiProfile.xml"
    
    # Import the WiFi profile using netsh command
    
    
    netsh wlan add profile filename=$wifiProfilePath user=all
    
    

    Make sure to replace "C:\\DeploymentShare\\Profiles\\YourWiFiProfile.xml" with the actual path to your WiFi profile XML file. You’ll need to have this XML file prepared in advance, which contains the configuration settings for the WiFi network you want to connect to.

    (to create the xml file use 'netsh export profile "%SSID%"' on a dive the has the profile)

    To integrate this script into your MDT task sequence:

    1. Save the script as a .ps1 file within your MDT deployment share.
    2. In the MDT Deployment Workbench, open your task sequence.
    3. Add a new task of type “Run Command Line”.
    4. In the command line, enter: powershell.exe -ExecutionPolicy Bypass -File "path\to\your\script.ps1"
    5. Ensure that the step is placed in the task sequence where the network connection is required.

    This script will add the specified WiFi profile to the Windows system during the deployment process, allowing the system to connect to the WiFi network automatically post-deployment. Remember to test the script in a controlled environment before using it in production to ensure it works as expected. If you need further customization or assistance, feel free to ask!

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Simon Ren-MSFT 35,311 Reputation points Microsoft Vendor
    2024-06-21T06:18:40.6133333+00:00

    Hi,

    Thank you for posting in Microsoft Q&A forum.

    You can follow below guides to use a run command line task sequence to add WIFI profile in MDT:

    Add a wireless profile to your MDT task sequence

    ADD WIFI PROFILE DURING OSD

    Thanks for your time. Have a nice day!

    Best regards,

    Simon


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Neuvi Jiang 1,450 Reputation points Microsoft Vendor
    2024-06-21T08:02:08.9933333+00:00

    Hi KarathIT,

    Thank you for posting in the Q&A Forums.

    If you have a Configuration Manager environment, you can create a Wi-Fi profile from versions prior to version 2203 (note: as of version 2203, this feature is no longer supported).

    In the Configuration Manager console, navigate to the Assets and Compliance workspace, select the Wi-Fi Profiles node, and then create a new Wi-Fi profile.

    Configure the required Wi-Fi settings, including SSID, security, and more.

    If you don't have Configuration Manager, you can manually create an XML or INI file that contains the Wi-Fi settings.

    These files usually contain information such as the Wi-Fi network's SSID, password, security type, etc.

    Step 2: Integrate the Wi-Fi profile into MDT

    You can write a PowerShell or CMD script that runs in an MDT task sequence and applies a Wi-Fi profile.

    The script can copy the configuration file to the target device and apply the settings using the netsh command or other methods.

    Add steps in the MDT task sequence:

    Open your deployment shares and task sequences in MDT.

    Add a Run Command Line step and specify your script path and parameters in it.

    Make sure the script runs at the right time, such as after the App OS and App Driver steps.

    Step 3: Test and verify

    Always validate your configuration and scripts in a test environment before applying changes to production.

    Ensure that the MDT deployment is successful and that the Wi-Fi settings are applied correctly.

    Troubleshooting:

    If you encounter any issues, review the MDT logs and script output for troubleshooting.

    Best regards

    NeuviJ

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.