Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Use Powershell to check whether and AD user exists

$
0
0

We're trying to clean up roaming profile folders, and as part of the task I need to check whether the user actually exists in AD.  I have tried 3 different methods and so far none of them work.

Either the empty result of the search doesn't equal $null (e.g. If ($objUser -eq $null) resolves to false) or Powershell crashes (like when I try to run that If statement).  So is there an AD User equivalent to Test-Path?

RF


Viewing all articles
Browse latest Browse all 2562

Trending Articles



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