Forum Discussion
darshan8822
Sep 13, 2021Copper Contributor
How to get hostname details from AD
Hi,
I need a PS script to extract the below details from AD.
hostname, createddate,ip address,createdby,bitlocker status,OU detials,USB details.
2 Replies
Sort By
- SteveMacNZIron Contributoras farismalaeb said not all of this information is stored in AD (depending on your configuration bitlocker keys may be stored in AD) you could cobble together a script to collect this information with a combination of Get-ADUser cmdlet, Ping/NSLookup, Get-WMIObject / PS remoting. depending on your firewall configurations.
Using a for loop process each AD object collect the various AD attributes storing them in different variables, then attempt a ping of the device - using an if statement to complete the Get-WmiObject lookups if the device is online (would also include some logic to check that IP address returned is the actual host you are looking for (since DNS can get stale leading to incorrect data) then write all the variable containing the collection information to a CVS file (using append) reset all the defined variables then move to the next device. - farismalaebSteel Contributor
Not all this information are stored in AD
information such as IP, USB details are not stored there, and even the Bitlocker as far as I know
To know what property you can get from AD Object, click on the adobject and then click on Attribute editor all these information can be read, other than that, depend