After writing up the presentation for MacSysAdmin in Sweden, I decided to go ahead and throw these into a quick cheat sheet for anyone who’d like to have them all in one place. Good luck out there, and stay salty. Get an ip address for en0: ipconfig getifaddr en0 Same thing, but setting and echoing a variable: ip=`ipconfig getifaddr en0` ; echo $ip View the subnet mask of en0: ipconfig getoption en0 subnet_mask View the dns server for en0: ipconfig getoption en0 domain_name_server Get information about how en0 got its dhcp on: ipconfig getpacket en1 View some network info: ifconfig en0 Set en0 to have an ip address of 10.10.10.10…
-
-
Bringing stroke Back
Stroke got moved, so dug this up and am reprinting with the latest and greatest location. Network Utility has a port scanner – it’s built in and really easy to use. Sure, stroke isn’t nmap, but it’s not trying to be… Since Network Utility is distributed with every copy of Mac OS X it stands to reason that every copy of Mac OS X has the ability to scan a port without using a GUI tool. Enter one of the best named tools in Mac OS X, stroke. Stroke is the command line back-end to the Port Scan tab of Network Utility. To use stroke, you will need to cd into the…
-
Bring Out Yer Apps with Autopkg! (Maybe with a little help)
(Guest post by Allister Banks) Working with modern tools in the ‘auto'(dmg/pkg) suite, it sure reinforces the old chestnut, ‘it’s turtles XML all the way down.’ The thing that struck me when first diving into using autopkg was that different product recipes could potentially have a good amount of similarities when they share common processors. One example is drag-drop apps that can be discovered with an ‘appcast’ URL, which, in my recollection, became common as the Sparkle framework gained popularity. This commonality is exactly the type of thing sysadmins like myself seek to automate, so I built a few helper scripts to 1. discover what apps have appcast URLs, 2. generate the base…
-
Check It Ma, Logz For Dayz
On a Mac, I frequently use the tail command to view files as they’re being written to or in use. You can use the Get-EventLog cmdlet to view logs. The Get-EventLog cmdlet has two options I’ll point out in this article. The first is -list and -newest. The first is used to view a list of event logs, along with retention cycles for logs, log sizes, etc. Get-EventLog -list You can then take any of the log types and view information about them. To see System information: Get-EventLog System There will be too much information in many of these cases, so use the -newest option to see just the latest:…
-
Reindex Spotlight from the Command Line
Spotlight is really a simple tool. Spotlight consists of mds, a command that is the metadata server, mdworker, the pawn that mds sends to scan objects and index them and then the three command lines of mdutil (manage the indexes), mdls (list metadata of an object) and mdfind, which as the name implies, finds things. All of this is used to keep a database called .store.db nested under .Spotlight-V100 at the root of each volume that’s been indexed. To reindex Spotlight from the command line, we’ll use mdutil. From a command prompt, enter the following to index your boot volume. sudo mdutil -E / Or an external drive named krypted:…
-
Control Windows Firewall From The Command Line
The Windows Firewall is controlled using the netsh command along with the advfirewall option. This command is pretty easy to use, although knowing the syntax helps. The most basic thing you do is enable the firewall, done by issuing a set verb along with a profile (in this case we’ll use current profile) and then setting the state to on, as follows: netsh advfirewall set currentprofile state on Or if you were controlling the domain profile: netsh advfirewall set domainprofile state on You can also choose to set other options within a profile. So to set the firewall policy to always block inbound traffic and allow outgoing traffic, use the…
-
Enable SSH, ARD, SNMP & the Remote Server App Use In OS X Server (Mavericks)
SSH allows administrators to connect to another computer using a secure shell, or command line environment. ARD (Apple Remote Desktop) allows screen sharing, remote scripts and other administrative goodness. SNMP allows for remote monitoring of a server. You can also connect to a server using the Server app running on a client computer. To enable all of these except SNMP, open the Server app (Server 3), click on the name of the server, click the Settings tab and then click on the checkbox for what you’d like to enter. All of these can be enabled and managed from the command line as well. The traditional way to enable Apple Remote…
-
Xsan Command Line Options In Mavericks Server
Before I get started, I just want to point out that the old commands all still work. There are some newer things, but nothing earth shattering. Let’s start out with what’s actually available in the Server Admin CLI: serveradmin. The serveradmin command, followed by settings, followed by san shows a few pieces of information: bash-3.2# serveradmin settings san san:computers = _empty_array san:primaryController = "95C99FB1-80F2-5016-B9C3-BE3916E6E5DC" san:ownerEmail = "krypted@me.com" san:sanName = "krypted" san:desiredSearchPolicy:_array_index:0 = "" san:serialNumbers = _empty_array san:dsType = 0 san:ownerName = "Charles Edge" san:managePrivateNetwork = yes san:metadataNetwork = "10.0.0.0/24" san:numberOfFibreChannelPorts = 2 san:role = "CONTROLLER" Here, we see the metadata network, the GUID of the primary (active) MDC, the name…
-
Configure Xsan in Mavericks Server
The first thing you should do when installing Xsan in any OS, much less Mavericks, is make sure your hostnames are awesome. Forward, reverse, views if you use them, etc. You have to have a dedicated metadata Ethernet network, so you should have a zone entry for both your primary and metadata network interfaces. You should also have fibre channel and storage configured and ready to use. Given that a lot of storage arrays take a long time to configure these days, I like to actually start that and then do my server setups while my LUNs/arrays are baking. Setting Up Xsan Once you have DNS entries, storage and fibre…
-
Install Exchange From the Command Line
Exchange is becoming more and more command line oriented. This includes the powershell options for managing Exchange once installed, but can also include the initial installation. To install Exchange from the command line, one must first install Exchange prerequisites, which are broken down per role that is being installed on Exchange. This can be done using the Add-WindowsFeature commandlet. To install the Windows requirements for Exchange for the Client Access, Hub Transport and Mailbox roles, use the following command: Add-WindowsFeature NET-Framework,RSAT-ADDS,Web-Server,Web-Basic-Auth,Web-Windows-Auth,Web-Metabase,Web-Net-Ext,Web-Lgcy-Mgmt-Console,WAS-Process-Model,RSAT-Web-Server,Web-ISAPI-Ext,Web-Digest-Auth,Web-Dyn-Compression,NET-HTTP-Activation,RPC-Over-HTTP-Proxy,Web-WMI -Restart For the Edge Transport role, use: Add-WindowsFeature NET-Framework,RSAT-ADDS,Web-Server,Web-Basic-Auth,Web-Windows-Auth,Web-Metabase,Web-Net-Ext,Web-Lgcy-Mgmt-Console,WAS-Process-Model,RSAT-Web-Server,Desktop-Experience -Restart For the Unified Messaging role, use: Add-WindowsFeature NET-Framework,RSAT-ADDS,ADLDS -Restart After the server restarts, also configure NetTcpPortSharing: Set-Service NetTcpPortSharing -StartupType…