none
How do I get disabled users from a text file via script? RRS feed

  • Question

  • I have a list of 50 domain users in text file, and I want to know if their accounts got disabled/delete via script. 

    I have a working script to get list of inactive domain users, but i want the script to look at my.txt list first and check if they are still with active or their accounts got disabled. 

    Thanks for your help in advance,

    Student

    Tuesday, August 23, 2016 1:08 PM

Answers

All replies

  • Post the script which you have tried.
    Tuesday, August 23, 2016 1:10 PM
  • Tuesday, August 23, 2016 1:22 PM
  • I have a list of 50 domain users in text file, and I want to know if their accounts got disabled/delete via script.

    There's no way to know if a script disabled an account. The security log will tell you which account disabled an account, but not if a script did it.


    -- Bill Stewart [Bill_Stewart]

    Tuesday, August 23, 2016 2:00 PM
    Moderator
  • Post the script which you have tried.
    https://gallery.technet.microsoft.com/scriptcenter/Get-Inactive-User-in-78b8db79#content 
    Tuesday, August 23, 2016 3:04 PM
  • I have a list of 50 domain users in text file, and I want to know if their accounts got disabled/delete via script.

    There's no way to know if a script disabled an account. The security log will tell you which account disabled an account, but not if a script did it.


    -- Bill Stewart [Bill_Stewart]

    I am not asking for a script-disabled accounts.   I wan the script to look at my 50 users in text file and tell me if any of them are disabled in the AD.        
    Tuesday, August 23, 2016 3:07 PM
  • I am not asking for a script-disabled accounts.   I wan the script to look at my 50 users in text file and tell me if any of them are disabled in the AD.        
    The links I posted will give you that information.

    Tuesday, August 23, 2016 3:08 PM
  • Post the script which you have tried.

    https://gallery.technet.microsoft.com/scriptcenter/Get-Inactive-User-in-78b8db79#content 
    What led you to choose that script? What else have you tried and with what results?

    -- Bill Stewart [Bill_Stewart]

    Tuesday, August 23, 2016 3:30 PM
    Moderator
  • Thanks, your links seems promising but my knowledge is limited . However, i will try my best and if i find solution i will post the step by step solution so the newbie could find it easy to implement it.

    Let me tell you about my setup.

    Location of text file is:

    c:\temp\my50UserNames.txt 

    example domain name: corp.example.com




    Wednesday, August 24, 2016 7:50 AM
  • Let's think about the basics. The pseudocode is:

    1. Read lines from a text file
    2. For each line in the text file, get the Active Directory user
    3. If the user is disabled, output that line

    How can we implement the above in PowerShell?


    -- Bill Stewart [Bill_Stewart]

    Wednesday, August 24, 2016 1:05 PM
    Moderator
  • Let's think about the basics. The pseudocode is:

    1. Read lines from a text file
    2. For each line in the text file, get the Active Directory user
    3. If the user is disabled, output that line

    How can we implement the above in PowerShell?


    -- Bill Stewart [Bill_Stewart]

    Correct, any solutions? 
    Wednesday, August 24, 2016 2:36 PM
  • Correct, any solutions? 
    Show us your attempts at this.

    Wednesday, August 24, 2016 2:37 PM
  • Please see the very first post from right at the top of this forum:

    This forum is for scripting questions rather than script requests


    -- Bill Stewart [Bill_Stewart]

    Wednesday, August 24, 2016 3:00 PM
    Moderator
  • Please see the very first post from right at the top of this forum:

    This forum is for scripting questions rather than script requests


    -- Bill Stewart [Bill_Stewart]

    Sorry for requesting (I was hurry, didn't read the rules).  You guys can delete the request if you want to.

    @Mike Laughlin,

    Im sure your links do the job and I will try it but not sure if I can do that with 10% experience I have in scripting :) 


    Friday, August 26, 2016 8:19 AM