Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Powershell script for AD help

$
0
0

Hi All,

I am trying to disable over 2 million unused Window accounts in Active Directory.  I have a powershell command I am running but it keeps on timing out.  To make this simple, I want to use command #1 example that I found from a Microsoft article.  Command #2 is the command I am running that keeps on timing out.  I want to insert it into command # 2, into Command # 1, but I am unsure where to add it or paste it.  Hoping someone can help me with this. 

Thanks for your help in advance,

TT

Command # 1: (I want to use this com # 1, however, I don't know where to copy and paste the parts in Com # 2, into Com # 1.  Also, if I need to delete any parts from Com # 1. ) 

$adobjects = get-aduser -Filter {-NOT(UserAccountControl -band 2)} -ErrorAction Stop; $adobjects | ForEach-Object {Start-Sleep -Milliseconds 200; $_}

Command # 2: (timing out command)

Get-ADUser -Filter 'Name -like "*"' -SearchBase "OU=users,DC=Test,DC=abc,DC=ca,DC=com" | Disable-ADAccount

Here is the article I found below:

http://social.technet.microsoft.com/wiki/contents/articles/32418.active-directory-troubleshooting-server-has-returned-the-following-error-invalid-enumeration-context.aspx

 



Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>