# Script to Turn Off Wi-Fi on macOS devices

Turning off Wi-Fi when not in use reduces energy consumption and increases the battery life of macOS devices. Hexnode lets admins [deploy scripts](https://www.hexnode.com/mobile-device-management/help/how-to-run-scripts-on-mac-using-hexnode-mdm/) to switch off Wi-Fi on macOS devices.

 Disclaimer: 
The Sample Scripts provided below are adapted from third-party Open-Source sites.

 

Turn Off Wi-Fi
--------------

Script to turn off Wi-Fi on macOS devices:

Script to turn off Wi-Fi on Mac

\#!/bin/bash networksetup -setairportpower $AIRPORT off 

   1

2

  \#!/bin/bash 

networksetup -setairportpower $AIRPORT off 

   

 

  

 Notes:- Once the script is deployed, the user will have to manually turn on Wi-Fi on the device to restore Wi-Fi connection.
- It is recommended to manually validate the script execution on a system before executing the action in bulk.
- Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.