Showing posts with label powershell. Show all posts
Showing posts with label powershell. Show all posts

Monday, May 7, 2012

Powershell: Get service tag or serial number

In case a machine name gets changed accidentally or perhaps your users have admin rights and decide to rename their computer the below powershell script will return you the true serial number or service tag. This is also useful in case the physical sticker or tag on the laptop or desktop has been rubbed off or is illegible.

Wednesday, April 4, 2012

Powershell: What AD accounts are set to never expire?



Here's a quick Powershell script that just came in handy for me recently. I was trying to find what users on our domain were given an exception to our password expiration policy and were set to never have their password expire.

Saturday, March 24, 2012

Powershell Script: Currently locked out accounts

The Microsoft certification training I'm doing now is just scratching the surface of what is possible with powershell but it was so intriguing I couldn't not do more research into what's possible with it. Even for those of us that don't have the time to essentially learn a whole new programming language can get quick benefits from learning a small amount.

Locked out active directory accounts are a constant problem (that I will discuss in a later post) where I work. But from a users  perspective they could be having a problem with "getting to the internet", "wifi", "email", or even "printing". All these services we provide hinge on their active directory account being in good working order.

So instead of manually searching for a users account these days I just use a powershell script to check if ANY accounts on the domain are locked out. At this point I just keep a powershell window open and hit Up Arrow and Enter to execute the script again.

Open up notepad or your text editor of choice and type the following:

Search-ADAccount -LockedOut | FT Name, ObjectClass, UserPrincipalName

Save this text file as lockedout.ps1

Now just open powershell and run your script!