VBScript to check if the computer is present in Active Driectory

I want to know is there any script to check if the machine is present in AD or not. Like say i have a machine named XYZ and i want to check if this machine is in AD or not.
Using VBScript how do i do this?
I am new to LDAP.
\m/

PowerShell
Import-Module ActiveDirectory
$computername = "xyz"
If ((Get-AdComputer $computername | Measure).count -eq 1){"PC with name $computername are present in AD"}
It must work on Win 2003/2008/r2/2012 DC with PowerShell v2, v3, v4
If PC with name "xyz" does not exist you have error
Cannot find object with identity 'xyz' under: 'DC=Contoso,DC=com'
This is not VBScript and it will not work on WS2003 domains.  You are also using methods that make little sense.
With the AD Cmdlets the following tests for specific a computer:
if(Get-AdComputer xyz){
     'computer found'
}else{
      'cpm[uter not found'
There are learning resources here.  I recommend that you review them to see how to use PowerShell.
http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
¯\_(ツ)_/¯

Similar Messages

Maybe you are looking for