locked account users, powershell review

Posted on 2014-08-29
Last Modified: 2014-09-02
Hi Experts,

I did recently downloaded a powershell script from the script MS page, however the script it does not or I missing some parameters.

I am in powershell calling the script as they suggest in the link below, but it just comes right back to the powershell prompt.  No error no nothing.  I have a feeling something is not where it is supposed to be.

I did create the following folders as per indicated on the script


I did download the tools exactly as the link states, but can you please indicate where should I enter my domain controllers on the script? I have 10 DCs that need to enter on the code.

I did also setup the execution policy in powershell to unrestricted, and Remotesigned, with no luck

By the way, I also imported the AD powershell module

Any ideas where to update the domain controllers on the script to use my new 10 DCs and then run the script?
Question by:Jerry Seinfield
    LVL 38

    Accepted Solution

    The scripts are functions.  You will need to run

    The above creates the functions so you can use them.  Then you have to run
    Get-AccountLockout -Account "someusername"

    Pretty much the entire script would have to be modified to support your 10 DCs.  It's hard-coded to only handle three, and even the third is commented out in places.  The script should probably be re-written to query for all domain controllers, and then dynamically handle all of them.

    Author Comment

    by:Jerry Seinfield
    Thanks fotech,

    Could you please re-writte the script and enter 10 generic DCs names?

    Perhaps something like below


    Author Comment

    by:Jerry Seinfield
    Can I please get an update ?

    Author Comment

    by:Jerry Seinfield
    Good Morning Footech

    How is the script going so far?

    Have you had a chance to modify the script and add new updates?
    LVL 38

    Expert Comment

    Frankly that goes against what I believe the purpose of the PowerShell topic area should be.  It should be for helping others with specific questions about PowerShell, understanding nuances, suggestions for optimization, assistance when stuck on how to code for a particular problem, etc.; and not for providing complete scripts for people (or as I like to call it, a "free scripting service").  I'll admit that that line is crossed from time to time, but I try to avoid it.

    The Get-AccountLockout script relies on another, which relies on two others.  It's a mess and I don't think I have want to devote all the time to clean it all up.  If you want to attempt it yourself and get stuck at specific points, feel free to open new questions.  Best of luck.

    Author Closing Comment

    by:Jerry Seinfield
    no comments

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    A commonly asked question on the site recently has been regarding how do I share the GAL between different forests? I want a list of Contacts representing all the users in a remote domain, How do i get them? It's a problem I was posed with a litt…
    Set OWA language and time zone in Exchange for individuals, all users or per database.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now