Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Automatically translated by Lango

image-20240913-124240.png Following procedure achieves an automated connection to Merlin WLAN on Die folgende Prozedur stellt eine automatische Verbindung zu Merlin WLAN unter Windows(R) her.

  • Copy the following script to your PC, we assume Kopieren Sie das folgende Skript auf Ihren PC, wir nehmen an C:\Zeisberg\merlinconnect.cmd as path als Pfad.

Expand
titlemerlinconnect.cmd Windows 10
Advanced code syntax highlighter
version2
{"code":"@echo off\n:: ----------------------------------------------------------------------------\n:: merlinconnect.cmd\n:: use:     merlinconnect SSID\n:: example: merlinconnect Merlin-12345\n:: This batch script determines, if the PC is connected to the WLAN which is\n:: named as parameter no. 1 and tries to establish the connection if it's not.\n:: This script can be run in a scheduled task to ake sure that the PC connects\n:: to a requested WLAN as soon as it becomes available.\n:: ----------------------------------------------------------------------------\n\n:: Tell how to use if no parameter is passed in\nif \"%1\"==\"\" goto print_help\n\n:: Get all active IPv4 network names. If the requested network is found, quit\n@For /F Tokens^=6^ Delims^=^\" %%G In ('%SystemRoot%\\System32\\wbem\\WMIC.exe\n /NameSpace:\\\\Root\\StandardCimv2 Path MSFT_NetConnectionProfile Where\n \"IPv4Connectivity='4' And Name Is Not Null\" Get Name /Format:MOF 2^>NUL'\n) Do if %%G==%1 goto connected\n\n:: if the requested network is not found, try establishing connection\necho connect now...\nnetsh wlan connect name=\"%1\"\ngoto exit\n\n\n:: if PC is connected to requested network, say so and quit\n:connected\necho PC is connected to requested WLAN \"%1\"\ngoto exit\n\n:: print help if no parameter passed in\n:print_help\necho use      merlinconnect SSID\necho note     The SSID must be a valid wlan profile. Connect one manually to create it.\necho example  merlinconnect Merlin-12345\ngoto exit\n\n:: exit of script\n:exit","theme":"coy","language":"batch","showLineNumbers":true}

Download provided for convenience Der Einfachheit halber wird ein Download angeboten (Windows 10):

View file
namemerlinconnect.cmd

Expand
titlemerlinconnect.cmd Windows 11
Advanced code syntax highlighter
version4
{"code":"@echo off\n:: ----------------------------------------------------------------------------\n:: merlinconnect.cmd\n:: use:     merlinconnect SSID\n:: example: merlinconnect Merlin-12345\n:: This batch script determines, if the PC is connected to the WLAN which is\n:: named as parameter no. 1 and tries to establish the connection if it's not.\n:: This script can be run in a scheduled task to ake sure that the PC connects\n:: to a requested WLAN as soon as it becomes available.\n:: ----------------------------------------------------------------------------\n\n:: Tell how to use if no parameter is passed in\nif \"%1\"==\"\" goto print_help\n\nnetsh wlan show interfaces | findstr /c:\"%1\" > null\nif %errorlevel% equ 1 (\n\tgoto unconnected\n) else ( \n\tgoto connected\n) \n\n:: if the requested network is not found, try establishing connection\n:unconnected\necho connect now to WLAN '%1' ...\nnetsh wlan connect name=\"%1\"\ngoto exit\n\n\n:: if PC is connected to requested network, say so and quit\n:connected\necho PC is connected to requested WLAN \"%1\"\ngoto exit\n\n:: print help if no parameter passed in\n:print_help\necho use      merlinconnect SSID\necho note     The SSID must be a valid wlan profile. Connect one manually to create it.\necho example  merlinconnect Merlin-12345\ngoto exit\n\n:: exit of script\n:exit","theme":"coy","language":"javascript","showLineNumbers":true}

Download provided for convenience Der Einfachheit halber wird ein Download angeboten (Windows 11):

View file
namemerlinconnect.cmd

  • Add a task to the scheduler as shown below

Note

Make sure to complete these two tests successfully after installation:

  1. Run the script in a command shell while the PC is not connected to Merlin
    ➡️ The script must announce that it connects to WLAN now.

  2. Run the script in a command shell while the PC is connected to Merlin.
    ➡️ The script must inform that the PC is already connected to Merlin.

The two variants of the script provided for download use different mechanisms to identify, if the PC is already connected to Merlin. Make sure to use the script variant that successfully detects an existing Merlin WLAN connection.

Description

Screenshot

Run Task Scheduler

image-20240913-124030.pngImage Removed

Name the task and set it to run irrespeecive of user login.

Click on Triggers.

image-20240913-124538.pngImage Removed

Add trigger for “At startup”.

Click OK

image-20240913-124645.pngImage Removed

Add trigger to repeat task daily every 5 minutes.

Note: the script doesn’t draw a lot of performance. This scheduled execution ensures, that the connection to Merlin is made irrespective of the sequence in which PC and Merlin are booted.

Click OK

image-20240913-124816.pngImage Removed

Click on Actions

image-20240913-125040.pngImage Removed

Add action to start a programm.

Enter the path to the script.

Pass the name of the WLAN to the script as parameter.

Note: The WLAN must be connected once manually to create a corresponding WLAN profile in Windows. See Merlin WLAN Koppelung for details on how to do that.

image-20240913-125159.pngImage Removed

...

  • Fügen Sie dem Planer eine Aufgabe hinzu (siehe unten)

Note

Stellen Sie sicher, dass Sie diese beiden Tests nach der Installation erfolgreich abschließen:

  1. Führen Sie das Skript in einer Befehlsshell aus, während der PC nicht verbunden ist an Merlin
    ➡️ Das Skript muss mitteilen, dass es jetzt eine Verbindung zum WLAN herstellt.

  2. Führen Sie das Skript in einer Befehlsshell aus, während der PC verbunden ist an Merlin.
    ➡️ Das Skript muss mitteilen, dass der PC bereits mit Merlin verbunden ist.

Die beiden Varianten des zum Download bereitgestellten Skripts verwenden unterschiedliche Mechanismen, um zu erkennen, ob der PC bereits mit Merlin verbunden ist. Achten Sie darauf, die Skriptvariante zu verwenden, die erfolgreich eine bestehende Merlin-WLAN-Verbindung erkennt.

Beschreibung

Bildschirmfoto

Task Scheduler ausführen

image-20240913-124030.pngImage Added

Benennen Sie die Aufgabe und legen Sie fest, dass sie unabhängig von der Benutzeranmeldung ausgeführt wird.

Klicken Sie auf Auslöser.

image-20240913-124538.pngImage Added

Auslöser für "Beim Starten" hinzufügen.

OK anklicken

image-20240913-124645.pngImage Added

Fügen Sie einen Auslöser hinzu, um die Aufgabe täglich alle 5 Minuten zu wiederholen.

Hinweis: Das Skript verbraucht nicht viel Leistung. Diese geplante Ausführung stellt sicher, dass die Verbindung zu Merlin unabhängig von der Reihenfolge des Bootens von PC und Merlin hergestellt wird.

OK anklicken

image-20240913-124816.pngImage Added

Klicken Sie auf Aktionen

image-20240913-125040.pngImage Added

Aktion zum Starten eines Programms hinzufügen.

Geben Sie den Pfad zum Skript ein.

Übergeben Sie den Namen des WLANs als Parameter an das Skript.

Hinweis: Das WLAN muss einmal manuell verbunden werden, um ein entsprechendes WLAN-Profil in Windows zu erstellen. Siehe Merlin WLAN Koppelung für Einzelheiten dazu.

image-20240913-125159.pngImage Added
Info

Klicken Sie im Aufgabenplaner auf Aufgabenplanerbibliothek, um die Aufgabe zu bearbeiten oder zu löschen:

image-20240913-125939.png