Filter to find users in AD

rated by 0 users
This post has 0 Replies | 1 Follower

Top 10 Contributor
Posts 211
Top Contributor
Krishna Posted: 01-20-2010 8:51 AM

 

$User = Read-Host "Enter the User name to search"
$Search = New-Object DirectoryServices.DirectorySearcher([ADSI]“”)
$Search.filter = “(&(objectClass=user)(sAMAccountName=$User))”
$Search.Findall()

 

Regards,
Krishna
http://smtpport25.wordpress.com

Page 1 of 1 (1 items) | RSS
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.