Monday, April 1, 2013

Script: Query AD for when users last changed their passwords

I ran into a challenging question today... My manager asked if I could get a report of all the users and when they changed their password. I knew I could get this via "DSGET and DSQUERY" but I wanted to force myself to use PowerShell. So here is the quick little script that I wrote that will do just that...

Assumptions: 
- You already have a TXT file on your computer that has a list of usernames for all the accounts
- You run these commands on a domain controller or a computer with the remote administration tools installed (to get the AD Module for PowerShell)


The Script:


Import-module activedirectory

$ErrorActionPreference="SilentlyContinue"

Stop-Transcript | out-null

$ErrorActionPreference = "Continue"

Start-Transcript -path C:\output.txt -append

$list = get-content c:\<path to the TXT file with your users in it>\users.txt

Foreach ($username in $list) {get-aduser -id $username -Properties passwordlastset |select-object -property name,enabled,passwordlastset}

Stop-Transcript


Notes:
The "Start-Transcript" and "Stop-Transcript"enable you to get the output in a TXT file so you can import it in excel for later use and manipulation.

Good luck!!!

My road to Hyper-V

Here I wanted to track my road to learning Microsoft Hyper-V.

Background:
I have worked with HyperVisors a lot in the past.

- Big fan of VMware ESX
- XenServer is ok (but only have ran Windows on it)
- Hyper-V is a new player to the market.

Microsoft Virtual Server 2005 was.... horrible. Just horrible. I really gave it it's fair shake but... no. Hyper-V 1 was, eh, ok. Worlds better than before but "Quick Migration" was the killer that kept it out of the enterprise. Hyper-V 2 was much better than 1. "Live Migration" means that it is now a contender for the enterprise market, however it still wasn't 100% there for management.

That brings us to Hyper-V 3. From what  have read and seen.... this version hit it out of the park. I love the management aspect of it now that it is MUCH cheaper (and from what I hear will manage vCenter as well).

I am going to concentrate a series of blog post related to what I learn in relation to Hyper-V 3. If you have any suggestions of where to look, gotcha's, examples, etc... please let me know.