The msiexec command can be used to run an installer on Windows in a zero touch fashion. To do so, run the following command: msiexec /i "python-2.7.14.amd64.msi" /passive TARGETDIR="C:\python"
-
-
Bash: Check That A Script Is Running As Root
Pretty much every script I’m working on these days must be run as root. Checking what user is running something is pretty straight forward, as there’s a built-in shell variable for $USER that contains the user running a script. To see this real quick, simply run the following: echo $USER You can then put this into your scripts. I’ve been using the same block of code for decades, which can be run in a script by itself if you’d like to paste this into one. if [[ $USER != "root" ]]; then echo "This script must be run as root" else echo "You are root" exit 1 fi Note: Keep in mind…
-
iconutil
Sometimes you just have to convert an iconset file to an icns file. And who knew, Apple was kind enough to give us a command to do just that in OS X! To use the iconutil command, run it with the -c option which indicates that the file will be converted. The -o indicates the file to convert a file to. Let’s use the myfile.iconset as the source file and then mynewfile.icns as the target file. The command would be as follows: iconutil -c myfile.iconset -o mynewfile.icns
-
Scripting in Google ChromeOS
I recently got my hands on one of those Google ChromeBooks (Cr-48). Interesting to have an operating system that is just a web browser. But, as anyone likely reading this article already knows, the graphical interface is the web browser and the operating system is still Linux. But what version? Well, let’s go on a journey together. First, you need ChromeOS. If you’ve got a ChromeBook this is a pretty easy thing to get. If not, check http://getchrome.eu/download.php for a USB or optical download that can be run live (or even in a virtual machine). Or, if you know that you’re going to be using a virtual machine, consider a pre-built…
-
Directory Services Scripting Changes in Lion
opendirectoryd Scripting directory services events is one of the most common ways that the OS X community automates post-imaging tasks. As such, there are about as many flavors of directory services scripts are there engineers that know both directory services and have a little scripting experience. In OS X Lion, many aspects of directory services change and bring with them new techniques for automation. The biggest change is the move from DirectoryService to opendirectoryd. In Snow Leopard and below, when you performed certain tasks, you restarted the directory services daemon, DirectoryService. The same is true in Lion, except that instead of doing a killall on DirectoryService, you do it on…
-
Scripting FaceTime
I will go through long stretches without playing with new technology until I either get unbusy or get talked into figuring out how to do something remotely interesting with it. Like linking FaceTime up to a help desk database. It turns out that Apple made it a very straight forward process. Simply use a facetime handler as the prefix to a URL with the phone number of the other person (iPhone 4) or their FaceTime email address (usually with the desktop app). For example, if my email were krypted@krypted.com then you could use the following from terminal: open facetime://krypted@krypted.com Or if my phone number were 310-555-1212 (it is you know;):…
-
Adding Objects To The Dock
Using Mac OS X, one of the most trivial things (provided you have permission) is to add an object to the dock. Applications go on the left side of the dock and folders/documents/stacks go on the right. From the command line it isn’t quite as trivial but not that complicated either. To do so from the command line, you can write directly into the com.apple.dock.plist for a user. To do so, we’re going to use the defaults command and we’re going to look at adding an application first: defaults write com.apple.dock persistent-apps -array-add ‘<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft Office 2008/Microsoft Word</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>’ You can also add a custom title for the object that you are adding…
-
Programatically Secure Erasing Free Space
One of those security things that pops up every now and then is to use the secure erase feature of Mac OS X, located in Disk Utility. But you can access this same feature from the command line using the secureErase option in diskutil followed by the freespace option. The format of the command is: diskutil secureErase freespace [level] [device] The levels are as follows (per the man page as not all of these are specified in Disk Utility): Single-pass zero-fill erase Single-pass random-fill erase US DoD 7-pass secure erase Gutmann algorithm 35-pass secure erase US DoE algorithm 3-pass secure erase So for example, let’s say you had a volume…
-
RDP from the Command Line
Let’s face it, connecting to Windows Servers is a must for many of us. And some of us want to do so programatically. I did look at populating the CoRD database in a previous article. But now, luckily CoRD has recently introduced a command line interface for managing just these types of connections on the fly as well. And, it is very straight forward. There are two ways to call CoRD from the command line. The first is similar to how we handled VNC in an earlier article. Simply leverage the open command and call the URL with a rdp in the beginning. For example, if you want to open…
-
Programatically Clipboarding in Windows
My last article showed how to interface with the clipboard in Mac OS X. Windows 7 comes with the same feature, but instead of pbcopy it’s simply clip. Since you don’t ls, we’ll pipe the output of dir into the clipboard: dir | clip Enjoy & no more complaining that I like one platform more than the other – you know who you are!