Windows 8 and 8.1 Forums


Powershell script Airplane Mode

  1. #1


    Posts : 3
    Windows 8

    Powershell script Airplane Mode


    I am writing a script to change my computer settings when I go to work and change them back when I get home.

    I would like to know how to script turning on/off Airplane Mode. If that's not possible, how do I script turning on/off wireless and Bluetooth?

    Code:
    $Office = 'e40fb68e-3e3a-4942-aa68-0490b7e7a790'
    $Balanced = '381b4222-f694-41f0-9685-ff5bb260df2e'
    
    
    $currHour = (get-date).hour
    
    
    if ($currHour -ge 7 -and $currHour -le 14) {
    
    
        powercfg -SetActive $Office
        
        #Disable-NetAdapter -Name "Wi-Fi"
    
    
        #Start-Service -displayname "Bluetooth service"
        
        } else {
        
        powercfg -SetActive $Balanced
        
        #Enable-NetAdapter -Name "Wi-Fi"
        
        #Stop-Service -displayname "Bluetooth service"    
    
    
        }

      My System SpecsSystem Spec

  2. #2


    Posts : 22,565
    64-bit Windows 10


    Hello Jesus, and welcome to Eight Forums.

    I'm not sure about with a PowerShell script, but you might see if the shortcuts below to turn Airplane Mode off and on may work for you. You could pin or use them where you like.

    Airplane Mode On or Off Shortcuts - Create in Windows 8

    Hope this helps,
    Shawn
      My System SpecsSystem Spec

  3. #3


    Posts : 480
    Windows 8 Pro x64


    You can always script disabling/enabling Wi-Fi and Bluetooth adapters with devcon (64-bit version is also available, but harder to find). So your script will have just a couple of iex lines
      My System SpecsSystem Spec

  4. #4


    Posts : 3
    Windows 8


    How did you program these apps to start/stop Airplane Mode? If it wasn't powershell, what environment was it?
      My System SpecsSystem Spec

  5. #5


    Posts : 480
    Windows 8 Pro x64


    I'm not sure I understand your question. devcon.exe is basically a command line version of device manager. You disable Wi-Fi adapter, there's no Wi-Fi, it's that simple.

    You can script it with CMD or call it from PS (get-help iex).
      My System SpecsSystem Spec

  6. #6


    Posts : 22,565
    64-bit Windows 10


    Quote Originally Posted by jesus4gaveme03 View Post
    How did you program these apps to start/stop Airplane Mode? If it wasn't powershell, what environment was it?
    I used AutoIt with sendkey commands to basically fully automate the keystrokes it would take to do it normally, but in one click now.
      My System SpecsSystem Spec

  7. #7


    Posts : 3
    Windows 8


    Quote Originally Posted by Brink View Post
    I used AutoIt with sendkey commands to basically fully automate the keystrokes it would take to do it normally, but in one click now.
    Thanks, I will give that a shot, but at this point I think I will use your apps with my PowerShell program.

    Do you know how I could make my program run in the background?
      My System SpecsSystem Spec

  8. #8


    Posts : 22,565
    64-bit Windows 10


    I'm afraid that I'm not experienced enough in PowerShell for that.
      My System SpecsSystem Spec

Powershell script Airplane Mode
Related Threads
Solved Missisng Airplane Mode PC-Desktop in Network & Sharing
Greetings all, and early Merry Christmas! The problem I have, on my desktop PC, is that I'm missing the Airplane Mode switch from all the areas it should be. I've done quite a bit of Googling and while there are a few people with similar issues, there has not really been any easy fix answers. ...
Hi I have Windows 8.1 installed on a Surface Pro 3. Six days ago the Flight mode toggle under "Change PC Settings - Network - Flight mode" was working fine. I could toggle flight mode on or off. Right now, however, Flight mode is toggled to "on" but greyed out. The strange thing is that...
hi i have problem with some app for example powershell or Troubleshooting see event : - <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> - <System> <Provider Name="Application Error" /> <EventID Qualifiers="0">1000</EventID> <Level>2</Level>
Win 8.1 desktop computer has airplane mode on and grayed out. There is no control switch on the PC or the wireless card. I have tried everything I see on line and nothing works. How do I shut off airplane mode? thanks, jp
Solved Airplane mode locked on in Network & Sharing
Hi, Bob Wilbanks here, I have a relatively new del laptop that has the airplane mode locked on. When I try to log it off the mouse has no effect on the open green on box. I tried the HOW TO TURN AIRPLAIN MODE ON OR OFF in Windows 8 and 8.1 My os is 8.1 The box would still not change. ...
Airplane Mode in Network & Sharing
Hi! Got a new toshiba recently, windows 8. For the last 2 days it keeps going automatically into airplane mode, making me loose my internet connection. Any ideas how to turn it permanently off?
Solved Airplane mode!!! in Network & Sharing
Hey everyone. I have just upgraded my laptop(Toshiba Satellite P875). From Windows 8 to 8.1 and now the airplane mode button does not switch the mode on and off??? I can go inside the settings and do it. But the button on the keyboard panel does nothing???:think: Did/DO anyone...
Eight Forums Android App Eight Forums IOS App Follow us on Facebook