how to verify whether computer is already exist in AD or not

-2

I am looking for a script which find the machine guid and search in Active directory whether it is exist or not

If exist provide me their "distinguish name"

I am looking for a powershell script but it is not recommended.

Note: I will be running this script in Window PE before joining the domain

Thanks in Advance

thrqureshi

Posted 2016-11-17T07:46:51.420

Reputation: 1

1What do you mean it's not recommended? What's your script so far? For the search in the AD you'd just use Get-ADComputer I guess. – Seth – 2016-11-17T09:07:06.847

1

Welcome to Super User! Please note that https://superuser.com is not a free script/code writing service. If you tell us what you have tried so far (include the scripts/code you are already using) and where you are stuck then we can try to help with specific problems. You should also read How do I ask a good question?.

– DavidPostill – 2016-11-17T13:04:23.147

Answers

0

its nice to include examples you've tried but

Get-ADComputer -Identity (objectGUID)

this will put it into the pipeline as a Microsoft.ActiveDirectory.Management.ADComputer type

What you do with it now is up to you. (pipe it to Get-member for options)

Using an example objectguid what you asked could be done like this

Get-ADComputer -Identity x00xx000-0000-000x-00xx-00000x00000x0 | select name

you'l get an error if it can't find the device.

Get-ADComputer : Cannot find an object with identity:

this could obviously be done a lot nicer but this is very basic and it should work.

Tim Mahood

Posted 2016-11-17T07:46:51.420

Reputation: 84