PowerShell Snapin’s

To use cmdlets from products like Exchange or Quest AD Management tools, you have to first load the snapin. The below commands are for each of the snapin’s that I use regularly. The first two Exchange related snapins are for Exchange 2007.

Add-PSSnapin Quest.ActiveRoles.ADManagement

 

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin

 

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Support

 

Report on users created in the past X number of days

The following PowerShell script will show you all the user accounts that have been created in a defined number of days.

Add-PSSnapin Quest.ActiveRoles.ADManagement
Set-QADPSSnapinSettings -DefaultSizeLimit 0
function Pause ($Message=”Press any key to continue…”)
{
Write-Host -NoNewLine $Message
$null = $Host.UI.RawUI.ReadKey(”NoEcho,IncludeKeyDown”)
Write-Host “”
}
$numberofdays = Read-Host "Please enter the number of days you would like to audit."
$Date = (get-date).adddays(-$numberofdays)
Get-QADUser -SearchRoot 'domain.com/OU' | where {$_.whencreated -ge $date} | Format-Table name, whencreated
Pause

	

Installing Administrative Tools on Windows XP

Below are the steps to enable remote administration for Windows Server technologies from a Windows XP.

  1. Go to http://www.microsoft.com/downloads/details.aspx?familyid=c16ae515-c8f4-47ef-a1e4-a8dcbacff8e3&displaylang=en and download adminpack.exe.
  2. Launch adminpak.exe and have it extract the contents to a common location.
  3. Go to the location where you had the files extracted and run adminpak.msi.
  4. Once you’ve finished installing the adminpak, you can to into the Administrative Tools folder that’s in the Control Panel and see all the available remote administration tools for Windows XP.

“Confirm Subtree Deletion” when deleting Computer Account

So I ran into an interesting issue last week when cleaning up old computer accounts in AD. I went to delete some old Hyper-V Virtual Machine accounts and got the following error.

It ends up that Hyper-V machines include additional objects to each computer account that you can’t see through Active Directory Users and Computers. I haven’t looked any further into this since I don’t currently have the time, but for anyone wondering, yes it’s safe to click yes on this pop-up box.