Caser

Turn off Wi-Fi via shell script

Need to send a Shell Script to disable the wi-fi network?  No problem!  Have multiple types of machines that may have different device ID’s for the wi-fi?  No problem!

#!/bin/bash

# By Chris
## This will send a power-down to the Wi-Fi Device.
## Tested on 10.8.2 with single Wi-Fi device/hardware.

## First we get the Wi-Fi device name.  We are not assuming it is en1.
# We do this by listing all the hardware on the device, then only showing the line of and immediately following "Wi-Fi".
# Then do a quick second grep to only show the line of the Wi-Fi setting with the "Device" tag.
# We then cut out the first part of the entries and keep with is on the right side (of the ":".
# And finaly we strip out the extra space (to be neat).

WiFiDev="`networksetup -listallhardwareports | grep -A 1 "Wi-Fi" | grep -C 0 "Device" | cut -d ":" -f 2 | tr -d " "`"

# echo $WiFiDev

## Now turn it off.

networksetup -setairportpower $WiFiDev off

echo "Turning off the port at $WiFiDev"

exit 0
till next time
Advertisements

Virtual Box, the easy way with Casper

We’ve been deploying VirtualBox on a one-to-one basis for the past year.  Each time someone requested vBox we would get their machine and install it.  Casper came along, and after some politics, we decided to give it a shot at building a Virtual Box installer with Windows 7 built-in.  While the end result still requires some hands-on to modify some settings (such as computer naming & binding to the AD), it is by far faster and easier to get a Mac to run Windows 7 in Virtual Box now.

The following are some considerations when planning your vBox.

  1. Not all software is legally allowed to be distributed “on image”.  Sometimes you’ll have to create a post-install process to do this (such as a GPO or Kace, BigFix, etc).
  2. Binding requires unique name, so you’ll want to bind after it is deployed.
  3. Do not have multiple partitions on the windows drive, you won’t be able to use the dynamic disk size of Virtual Box if your second partition has space left on it.
  4. You’ll want to make sure you setup the storage area to be in a shared space, so it is accessible by more than just the user who created the package.

These are just some of the warnings, however the pay-off is worth it.  If you have a paid application for virtualization (Parraellels, VMWare) it is far easier than with vBox (in my opinion), but again you can’t beat the price of Virtual Box.  That advantage of Casper is that you can push the user preferences for VirtualBox out as a separate package, available For Exisiting Users, or For User Template.  We’re in the testing stages now, but if all goes as planned, we’ll have a simplified Virtual Box deployment in the near future.

I’ll post updates when complete (maybe even the file paths if I get the time).

Till next time.