title: How to exclude 1 OU from a script
body: <p>So I'm trying to get a PowerShell script that will search and disable all accounts that have been inactive for x amount of days. But I want it to skip over 1 OU where it doesn't search and disable any of the users in the OU. and then move all the disabled users to 1 single OU</p>
  <p>This is the code I currently have. I am missing the exclude portion.</p>
  <p>Use this code to disable accounts that have been inactive for X amount of days</p>
  <pre><code>Search-ADAccount -SearchBase “OU=example,DC=example,DC=com” -AccountInactive -TimeSpan (\[timespan\]0d) -UsersOnly | Set-ADUser -Enabled $false
  </code></pre>
  <p>Use this code to move users</p>
  <pre><code>Get-ADuser -SearchBase “OU=example,DC=example,DC=com” -filter {Enabled -eq $false} | Move-ADObject -TargetPath “OU=Computers,OU=example,DC=example,DC=com”
  </code></pre>
  <p>I'm not 100% sure how to use the exclude command and i tried googling and finding other scripts that could potentially work, but nothing has so far</p>