search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Check Active Directory User If Already Exist
Posted in Virtual Machine Manager, Windows Powershell | No Comment | 3,676 views | 17/06/2009 11:18

We can check Active Directory users with dsquery command on Powershell and Command Prompt (CMD). It’s very basic command to find a user in a directory. Lets check John Connor if He is already in Skynet Active Directory:

1
2
3
4
5
6
7
8
9
10
$samID = "john.connor"
$checkaduser = dsquery user -samid $samID
if ($checkaduser -like "*OU=Skynet*")
{
Write-Host "That user already exist in Skynet Active Directory."
}
else
{
.\createaduser.ps1 "FirstName" "LastName" "SamID" "Password"
}

Can you believe Skynet using Active Directory to store users? I don’t think so but who knows?



Leave a Reply