Tiny Deathstars of Foulness

By default, the Active Directory Powershell management tools are not installed on Windows Servers. Commandlets are instead installed when the Active Directory Domain Controller role is added. However, you can install them even without installing the role. To do so, open Server Manager and go to Add and Remove Roles and Features. Don’t add any Roles, instead skip to add features. Then open Remote Server Administration Tools and then Role Administration Tools. From there expand on AD DS and AD LDS Tools and then highlight the Active Directory Module for Windows PowerShell. ADTools Once enabled, click Next through the end of the wizard. Once the wizard is complete, open Powershell and use the following command: import-module ActiveDirectory Once you’ve imported the Active Directory modules, let’s test it by creating a user with the new-aduser commandlet, as follows (assuming a name of krypted): new-aduser -name krypted

April 5th, 2014

Posted In: Active Directory, Mass Deployment, Microsoft Exchange Server, Network Infrastructure, Windows Server

Tags: , , , ,

A really neat new feature in 2012R2 is that Hyper-V can resize a running virtual machine (.vhdx) to the smallest possible size, while the virtual machine is running. To do so, use Get-VM in PowerShell. Here, we’ll use the -Path option to define the location of our vhdx, the -ToMinimumSize option to indicate that we’d like to shrink it down as low as we can go and -AsJob so it runs in the background: Resize-VHD –Path D:\myVM.vhdx –ToMinimumSize -AsJob

March 16th, 2014

Posted In: Windows Server

Tags: , , , , , , ,

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: Get-EventLog system -newest 5 The list will have an Index number and an EventID. The EventID can then be used to research information about each error code. For example, at

February 8th, 2014

Posted In: Microsoft Exchange Server, Windows Server, Windows XP

Tags: , , , , , , , , , , ,

Need to export mailboxes from Exchange? Hate using exmerge to do so. Gone are the days of exmerge. Well, not entirely. But welcome to the days of New-MailboxExportRequest. Much longer and cooler command than exmerge ever thought about being. C:\>New-MailboxExportRequest -Mailbox cedge -FilePath \\\pst\cedge.pst You then receive confirmation that the export has been queued: Name Mailbox Status ---- ------- ------ MailboxExport Queued To view the status, swap New with Get (Get-MailboxExportRequest): Get-MailboxExportRequest The output is as follows: Name Mailbox Status ---- ------- ------ MailboxExport InProgress To get even more info, use the -Name option with Get-MailboxExportRequest, identifying the actual process name. Get-MailboxExportRequest -Name MailboxExport | fl The output is as follows: RunspaceId : xxxxxxx-aaaa-bbbb-cccc-zzzzzzzzz FilePath : \\\pst\cedge.pst SourceDatabase : MB-HO-01 Mailbox : Name : MailboxExport RequestGuid : aaaaaaaa-bbbb-cccc-dddd-000000000000 RequestQueue : AA-BB-02 Flags : IntraOrg, Push BatchName : Status : InProgress Protect : False Suspend : False Direction : Push RequestStyle : IntraOrg OrganizationId : Identity :\MailboxExport IsValid : True To check the progress of all mailbox export requests, pipe Get-MailboxExportRequest into Get-MailboxExportRequestStatistics: C:\>Get-MailboxExportRequest | Get-MailboxExportRequestStatistics The output shows the completion percentage of each process Name: Name Status SourceAlias PercentComplete ---- ------ ----------- --------------- MailboxExport InProgress cedge 20 To clear completed requests: C:\>Get-MailboxExportRequest | where {$_.status -eq "Completed"} | Remove-MailboxExportRequest

October 31st, 2013

Posted In: Microsoft Exchange Server, Windows Server

Tags: , , , , , , , , , ,

There are a number of features that make mass deployment of Mac OS X pretty easy. Some of these would be great to have in Windows. These range from systemconfiguration to networksetup and the ability to look at packages that have been installed and review their bills of material. Well, the good people at Vexasoft have built a number of Powershell libraries that, while they aren’t named as such, do a number of the features that these commands do, just for Windows clients via Powershell. And the best part is, a number of them are free. Let’s look at what some of these commands do:
  • First, there are the cmdlets used to manage the network stack (so similar to various verbs in networksetup). These include Add-NetworkAdapterDNS, Add-NetworkAdapterGateway, Add-NetworkAdapterIP, Disable-NetworkAdapter, Enable-NetworkAdapter, Get-NetworkAdapter, Remove-NetworkAdapterIP, Remove-NetworkAdapterGateway, Remove-NetworkAdapterDNS, Set-(followed by the others from the above sets) and Rename-NetworkAdapter.
  • Second, you can automate binding with Set-Domain. This is similar to dsconfigad but less awesome because it’s third party, but still more awesome than the native tools because it’s easier.
  • Third, rename the system. This is similar to scutil, hostname, sets. Just use Rename-Computer to change the name of a Windows system.
  • My favorite, having written something similar, is probably Get-RemoteDesktopConfig and Set-RemoteDesktopConfig, similar to the kickstart options in OS X.
  • And a tool similar to installer in OS X, Install-MSIProduct, which installs MSIs.
  • Sixth, there’s Set-Pagefile, because if you’re gonna’ change it, do so while imaging to save a reboot later…
  • While there are others, the final one I’d like to mention is still free: Get-RegistryKey, which gives us the ability to basically run the closest thing to defaults commands I’ve found against the Windows platform.
They install as standard Powershell modules, making them easy to drop into practically any imaging environment. Much of these can be done via WMI or Powershell already, but will require a bit more legwork to script. Having them pre-built makes it easier than ever to perform some basic tasks for other platforms en masse, on Windows.

June 14th, 2012

Posted In: Mass Deployment, Windows Server, Windows XP

Tags: , , , , , , , , , , , ,