Script required to automatically connect to specific Wi-Fi network

Page 2 of 8 FirstFirst 1234 ... LastLast

  1. Posts : 17,092
    Windows 10 Home x64 Version 22H2 Build 19045.4894
       #11

    Michael,

    When you complete this, in what way will your automatic connection setup differ from simply having set that network to connect automatically in the normal way?

    I have read all the posts and I cannot see what difference there is going to be other than complexity.

    Denis
      My Computer


  2. Posts : 7,631
    Windows 10 Home 20H2
       #12

    Michael, please do the following test:

    Right-click on the Start button --> Windows PowerShell. Run the following command:

    Start-Process "D:\Users\Michael\Desktop\WLAN connect.vbs"

    Replace Michael with the actual name.
      My Computer


  3. Posts : 7,631
    Windows 10 Home 20H2
       #13

    The following setting works as long as the file path is correct.

    Script required to automatically connect to specific Wi-Fi network-correct-file-path.jpg
      My Computer


  4. Posts : 1,807
    Windows 10 Pro 21H1 19043.1348
    Thread Starter
       #14

    Try3 said:
    Michael,

    When you complete this, in what way will your automatic connection setup differ from simply having set that network to connect automatically in the normal way?

    I have read all the posts and I cannot see what difference there is going to be other than complexity.

    Denis

    Hi Denis, correct me if I'm wrong, my thinking was that if I'm not logged on, there would be no network connection. Microsoft and other special companies often sneak a task into the task scheduler to start your PC and then update or whatever suits their fancy.

    If a network connection was dependent on a successful login, would that not protect against this nasty practice?
      My Computer


  5. Posts : 17,092
    Windows 10 Home x64 Version 22H2 Build 19045.4894
       #15

    W10 Tweaker said:
    Microsoft and other special companies often sneak a task into the task scheduler to start your PC and then update or whatever suits their fancy.
    Michael,

    They cannot do that if you have turned the computer off or have logged off all users. They can only do that if you hibernate or sleep the computer - which means still being logged on.

    So I don't think your hard work is changing anything at all.

    Denis
      My Computer


  6. Posts : 1,807
    Windows 10 Pro 21H1 19043.1348
    Thread Starter
       #16

    Matthew Wai said:
    Michael, please do the following test:
    Matthew Wai said:

    Right-click on the Start button --> Windows PowerShell. Run the following command:

    Start-Process "D:\Users\Michael\Desktop\WLAN connect.vbs"

    Replace Michael with the actual name.





    Thanks for your support.


    OK, using this vbs with Powershell was successful. Now I must divulge further details. The error I posted earlier was the same error I was seeing but the path is very different.

    I have two sets of files I've been experimenting with, both sets of files are same except the file locations and path in the vbs. One set is on my Desktop for easy access and the other is the planned final working destination at C:\Scripts\WLAN.

    Having said all that, I apologize for not being more precise with my info. I also may have slipped up somewhere with syntax because I have set everything back to the original test state with only a couple of minor tweaks, now I can successfully connect by running the task in the Task Scheduler.

    Unfortunately, the task does not run automatically when returning from sleep.
      My Computer


  7. Posts : 1,807
    Windows 10 Pro 21H1 19043.1348
    Thread Starter
       #17

    Try3 said:
    Michael,

    They cannot do that if you have turned the computer off or have logged off all users. They can only do that if you hibernate or sleep the computer - which means still being logged on.

    So I don't think your hard work is changing anything at all.

    Denis


    Exactly, I usually use sleep instead of a full shutdown.


    So if my PC is logged off and in a sleep state, if the network connection was not disconnected, does that not leave me at risk?

    If my network connection is dependent on my being logged in, does that not further isolate the PC during a sleep state?

    I'm hoping I have this correct but certainly appreciate hearing if you know differently. Thanks.
      My Computer


  8. Posts : 17,092
    Windows 10 Home x64 Version 22H2 Build 19045.4894
       #18

    W10 Tweaker said:
    Exactly, I usually use sleep instead of a full shutdown.
    So if my PC is logged off and in a sleep state, if the network connection was not disconnected, does that not leave me at risk?
    If my network connection is dependent on my being logged in, does that not further isolate the PC during a sleep state?
    I'm hoping I have this correct but certainly appreciate hearing if you know differently. Thanks.
    You are not logged off during sleep.
    If you log off you have no method of entering sleep.

    AND

    If you are connected but log off from all users, that network remains connected.

    Denis
      My Computer


  9. Posts : 7,631
    Windows 10 Home 20H2
       #19

    W10 Tweaker said:
    Unfortunately, the task does not run automatically when returning from sleep.
    Fortunately, there are other ways to run a task when Windows wakes from sleep.
    In Task Scheduler, try the following settings:

    Source: Kernel-Power Event ID: 131
    Source: Power-Troubleshooter Event ID: 1

    Script required to automatically connect to specific Wi-Fi network-image-7.jpg
      My Computer


  10. Posts : 1,807
    Windows 10 Pro 21H1 19043.1348
    Thread Starter
       #20

    Try3 said:
    You are not logged off during sleep.
    If you log off you have no method of entering sleep.

    Denis

    Hmmm, that makes sense. Of course the user isn't logged off during sleep or hibernate, I think I was mixing offline with logged off. OOPs.

    How about, if my PC is sleeping, network connection is disconnected, am I not isolated until I reconnect?


    BTW, I just fixed my problem. I added the trigger 'On Workstation unlock' to the Task Scheduler. Now when I close the lid or sleep, upon opening the lid and unlocking the PC, it runs the script and logs into the Wi-Fi automatically.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 11:06.
Find Us




Windows 10 Forums