Category Archives: Labs

Posts about computer labs and classrooms at Williams College

Mac – Using Install command line to install packages

Some software can not be installed on the master image computer because it needs to be uniquely installed on each clone.  So rather then have to copy packages to each clone after imaging, why not put the packages in a known location and then call the installer remotely using the command like:


installer
-pkg /Users/labadmin/Desktop/post/Sophos_10.mpkg -target /

 

See the complete man page at:

https://developer.apple.com/library/mac/documentation/darwin/reference/manpages/man8/installer.8.html

Mac – Apple Remote Desktop Hangs – Kill the process

Sometimes Apple Remote Desktop hangs on the remote computer and/or you get disconnected.  When that happens you can get the message “can not control remote computer because it is running Apple Remote Desktop or another administrative application”.  To “fix” this …

With ARD on the local computer, Send the Unix command:

ps -A

This will a list of processes which are running on the remote computer.  Find the process number, the PID, for the Apple Remote Desktop application process and then give the command (send a unix command):  kill -KILL “PID#”  (change “PID#” to the actual pid #)

WARNING – the kill -KILL command is not kind.  It will stop any process without additional double check and, therefore, if you kill the wrong PID you can cause the system to halt and become completely unresponsive.

as in:

kill -KILL 25204

Mac – Removing printers with command line

I use lpadmin -x to remove printers when needed as in:

lpadmin -x Spencer-116-Color

lpadmin can be used for a bunch of other chores.  See:

https://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man8/lpadmin.8.html

Interestingly, the -x option isn’t listed in the man page!

See also: http://hints.macworld.com/article.php?story=20061203221317612 For additional options like clearing queues …

 

Windows – Change computer decsription from command line

Sometimes it’s useful to use the computer description field to store information like the the image version.  I typically do this in automated post imaging tasks, however, it is sometime necessary to manually reset this description field.

The command line to do that is:

net config server /srvcomment:computer_description

See: http://lifeofageekadmin.com/changing-windows-computer-description-from-a-command-prompt/

Mac – Mt Lion – Disable Notification Center

With Mt Lion, Apple introduced a unified notification center application that alerts you to a number of things like email, etc.  Unfortunately, it also alerts you to recommended system updates. All of this is unwanted on lab/classroom computers.

I have found that the best way to stop the notification center is to hide the application were it lives.  To hide things on Mac OS X, just like in unix, rename them to something that starts with a “.”  Therefore, in /System/Library/CoreServices rename  NotificationCenter.app to .NotificationCenter.app

This command may do the trick ….

sudo mv /System/Library/CoreServices/NotificationCenter.app /System/Library/CoreServices/.NotificationCenter.app

 

Mac – Turn wireless on or off via command line

To control the network settings with the command line try:

networksetup -listnetworkserviceorder

Then:

To display current state of wireless:

networksetup -getairportpower <device name>

Or to turn wireless off or on:

networksetup -setairportpower <device name> <on off>

For a longer description of these see:

http://reviews.cnet.com/8301-13727_7-57566448-263/how-to-adjust-network-settings-in-os-x-via-the-command-line/

Mac – Add Login items – Startup programs for all user

On the mac to have an application start automatically for all users add the application to the file “loginwindow.plist” in /Library/Preferences.

An example:

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
<plist version=”1.0″>
<dict>
<key>AutoLaunchedApplicationDictionary</key>
<array>
<dict>
<key>Hide</key>
<false/>
<key>Path</key>
<string>/Applications/PCClient.app</string>
</dict>
</array>
</dict>
</plist>

For details see:

https://sites.google.com/site/selkirkitknowledgebase/home/mac-os-x/startup-item-for-all-users