• Windows Server,  Windows XP

    Use PowerShell to Query WMI on Windows Servers

    I recently needed to check and see whether a backup drive (which was just a 4TB USB drive) was plugged into a server. But the server had no GUI, so I had to use the command line. There was no drive letter mapped to this drive, so I needed to use something else and I needed to make a script that could be used long-term. Luckily, PowerShell can be used to obtain WMI information on the hardware installed on a computer. This allows administrators to query WMI about the USB devices currently installed on a server. In the following command, we’re going to use gwmi from PowerShell and we’re going…

  • Mac OS X,  Windows XP

    Produce Random Complex Passwords in Excel

    Recently, I’ve been spending a lot of time normalizing data in Excel. And when I needed to generate a bunch of passwords for a project, I almost switched to another tool to do so. But I decided that I was already in Excel so I might as well do it there. Excel has a couple of random (pseudorandom) number and character functions in RAND() and RANDBETWEEN(). In its simplest, let’s just pick a number between one and ten: =RANDBETWEEN(1,10) Now let’s pick a number that’s 9 characters after a decimal: =RAND() Or make it a regular nine character number: =RAND()*1000000000 Regrettably numbers are OK for passwords. So let’s bump up…

  • Mac OS X,  Mac OS X Server,  Mac Security,  Mass Deployment,  Windows XP

    Scripting PGP Whole Disk Encryption On A Mac (or Windows, really)

    The PGP Whole Disk Encryption (WDE) tools have a command line interface for both OS X and Windows. The options are mostly the same across the two. We’ll focus on two for the purposes of this little article. The first is –list-user and the second is –change-passphrase, although there are a number of other options. A general breakdown of the options include the following: –enum – show the disks available –disk-status – show the encryption status disk indicated with the –disk option –stop – stop the encryption or decryption process of a –disk using –passphrase –instrument – Install BootGuard using the –disk option followed by the number of the disk…

  • Microsoft Exchange Server,  Windows Server,  Windows XP

    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:…

  • Active Directory,  Microsoft Exchange Server,  Windows Server,  Windows XP

    Kill Processes In Windows

    You always want to stop a process gracefully. However, sometimes it’s just not possible to do so. Sometimes, you have to kill a process. Sometimes you have to end a process or a process tree when you can’t restart them gracefully. To stop a process in Linux and Mac, use the kill command. In Windows, there’s a Powershell cmdlet called Stop-Process that enables you to terminate a process. As with kill, just add the process ID at the end of the command. For example, to stop process 318: Stop-Process 318 Or you can stop based on the name of the process using the -processname option. For example, to kill a…

  • Windows Server,  Windows XP

    Net Stats & Windows Server

    Windows Server tracks the sessions that have been authenticated into the system, those that have been timed out, those that have errored, kb sent/received, response time, errors, permission problems, password problems, files opened, print job spooling and buffers quickly and easily. Simply use the net command we’ve all been using for 20 years, followed by stats or statistics: net statistics When prompted choose server or workstation. In this case, we’ll use Server. net statistics Server Here’s the output from a new server: And if you’re trying to troubleshoot client/server communications, keep in mind that you can look at much of this on the workstation side as well, but from the…

  • Windows Server,  Windows XP

    Run Windows Updates From The Command Line

    Windows Updates can be run using a standard batch script. Do so using the wusa.exe is the command that runs updates that you specify. These updates are run using the wusa command, nested inside the Windows directory (%WINDIR%\SysNative to be exact). To run, specify the path to the package you’d like to install. In this case, I’ve mapped a drive to my updates, and placed each in a directory named after the update ID. To run, just run with the path to the .msu file: wusa.exe U:\2862152\Windows8.0-KB2862152-x86.msu To then uninstall the package (if you dare), use the /uninstall option. In this command, you don’t need to provide the path, only…

  • Windows Server,  Windows XP

    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…

  • Active Directory,  Microsoft Exchange Server,  Network Infrastructure,  Windows Server,  Windows XP

    Managing DNS In Windows Server 2012

    Previously, I covered installing the DNS role in Windows Server 2012. Once installed, managing the role is very similar to how management was done in Windows Server 2003 through 2008 R2. With the exception of how you access the tools. DNS is one of the most important services in Windows Servers, as with most other platforms. So it’s important to configure DNS. To get into the DNS Manager in 2012 Server, first open Server Manager (you might get sick of using this tool in Server 2012, similar to how my Mac Server brethren have gotten tired of it in Lion and Mountain Lion Servers. Then from Server Manager click on…

  • Active Directory,  Mac OS X,  Mac OS X Server,  Mac Security,  Network Infrastructure,  Ubuntu,  Unix,  VMware,  Windows Server,  Windows XP,  Xsan

    List All DNS Records For A Domain

    Sometimes you want to move a domain but you don’t have a copy of the zone file in order to recreate records. The easy way to do this is to grab a zone transfer. To do so, dig is your friend: dig -tAXFR mycompany.com Sometimes though (and actually more often than not) a zone transfer is disabled. In that case you’ll need to dig the domain a bit differently. I like to use +nocmd, query for any and list the results (+answer): dig +nocmd https://krypted.com/ any +answer Which results in the following: ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39183 ;; flags: qr rd ra; QUERY: 1,…