Tag Archives: Command

Mac – Set NTP time server from command line

Active Directory login, Keyserver access, SafeConnect, etc all require the connecting client to have a time setting that is within 5 minutes or so of the server’s time setting.  It is therefore useful to use a “network time protocol” server to set your local computer’s time to the “correct” time.

Macs typically use “time.apple.com” to set their time from the network.  This is fine most of the time. 😉

In the rare times you want to set a different time server on a Mac, use Terminal and enter the command:

sudo systemsetup -setnetworktimeserver <timeserver>
(replace <timeserver> with the address of the time server 
you want to use as in 137.165.4.21 for Williams College)

Since this is a command run with “sudo”, you’ll be asked to enter the account password and that account needs to be authorized as a “Super User” or “root” user.

By the way – the GUI interface in the “Date & Time” System preference only allows you to choose time servers hosted by Apple.

For more details see the web page at:

http://hints.macworld.com/comment.php?mode=view&cid=98039

 

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 – 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 – 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/