header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Removing Inactive ad accounts
Last Post 15 Sep 2011 06:00 AM by ccastro. 8 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
NipperUser is Offline
New Member
New Member
Posts:7
Avatar

--
30 Aug 2011 08:30 AM
    So I was tasked with running a powershell script that reports back all inactive accounts that are 90 days old.  I know how to disable these accounts however some of them are system accounts that are used for various things that don't need to be deleted.


    What is the best method to go about excluding certain accounts that are 90 days old whether it be via txt file or possibly a particular OU?
    Karl MitschkeUser is Offline
    Basic Member
    Basic Member
    Posts:457
    Avatar

    --
    30 Aug 2011 08:54 AM
    If you have Exchange, use one of the extension attributes.

    If you don't have Exchange, you can extend your schema to include a new attribute.
    See http://www.informit.com/articles/ar...0&seqNum=3

    Karl
    http://unlockpowershell.wordpress.com
    Co-Author, Windows PowerShell 2.0 Bible
    -join("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})
    NipperUser is Offline
    New Member
    New Member
    Posts:7
    Avatar

    --
    30 Aug 2011 08:57 AM
    I could assign the "new attribute" to all the accounts that I didn't want disabled correct?

    Then do an exclusion on that attribute when disabling the accounts correct?
    Karl MitschkeUser is Offline
    Basic Member
    Basic Member
    Posts:457
    Avatar

    --
    30 Aug 2011 09:08 AM
    Right
    http://unlockpowershell.wordpress.com
    Co-Author, Windows PowerShell 2.0 Bible
    -join("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})
    NipperUser is Offline
    New Member
    New Member
    Posts:7
    Avatar

    --
    30 Aug 2011 12:01 PM
    What command would I use if I wanted to exclude members of a specified security group?
    Mwalker72User is Offline
    New Member
    New Member
    Posts:11
    Avatar

    --
    01 Sep 2011 01:47 AM
    If all your Service accounts have a common naming convention you could exclude names starting with " xxx " in your script ??
    ccastroUser is Offline
    New Member
    New Member
    Posts:27
    Avatar

    --
    12 Sep 2011 05:13 AM
    I have 2 specific accounts (owners of the company) who are using Macs and don't often log onto the domain. In my inactive accounts script I'd like to exclude those two accounts based on each of their SamAccountName. What specific coding/command/filter can I use to make sure their accounts don't get disabled? Below is the script I'm currently using check for inactive accounts, disable them and move them to another OU:

    # Search for 90 day inactive accounts, write log file, disable those users and move to another OU
    $Users = Get-QADUser -SearchRoot 'domain/employees' -Notloggedonfor 90
    If (!$Users) { Write-Host "variable is null" }
    If ($Users){$file = "c:\users\username\Documents\Inactive.csv"}
    If ($Users){$Users | Select displayname, samaccountname, lastlogontimestamp | Export-csv $file -NoTypeInformation}
    If ($Users){$users | Foreach-object {Disable-QADUser -identity $_
    Move-QADObject $_ -to 'domain/Employees Inactive Accounts'}}

    Any help?
    ccastroUser is Offline
    New Member
    New Member
    Posts:27
    Avatar

    --
    12 Sep 2011 06:09 AM
    I don't want to edit the schema and add an attribute. I just want to set a filter on my search, but I'm not sure how to do that.
    ccastroUser is Offline
    New Member
    New Member
    Posts:27
    Avatar

    --
    15 Sep 2011 06:00 AM
    Any help?
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer