Solved

Active Directory Inventory

Posted on 2014-10-20
3
119 Views
Last Modified: 2014-10-28
see any issues? i know i am missing dc= but other then that?


import-module activedirectory

$results = @()
$computers = Get-ADComputer -Filter * -SearchBase "OU=Servers,DC=,DC=,DC=global" | select -expandproperty name
foreach ($computer in $computers) {
$results += Get-WmiObject Win32_ComputerSystemProduct -ComputerName $computer| Select @{Name="Computer Name";Expression={$computer}},Vendor,Name,IdentifyingNumber
}
$results | Export-CSV C:\ComputerInfo.csv -nti
0
Comment
Question by:Jorge Ocampo
  • 2
3 Comments
 
LVL 16

Assisted Solution

by:Joshua Grantom
Joshua Grantom earned 250 total points
ID: 40393305
what was the error you got when running it Jorge? I tested the original script on my network and it worked.

I would make sure your searchbase is an actual OU and not just a container.
Right-Click on the Server (OU or COntainer) and select properties. Go to the Attribute Editor and find distinguishedname. Does it have an OU= or a CN= next to Servers?

Also, to see the attribute editor you have to make sure that you have advanced features selected under the view menu in ADUC
0
 
LVL 16

Expert Comment

by:Joshua Grantom
ID: 40393324
You also may have to many DC's in there

most environments do not have sub domains. It would most likely be

OU=Servers,DC=mydomain,DC=global

meaning your domain is mydomain.global
0
 
LVL 6

Accepted Solution

by:
Vipin Vasudevan earned 250 total points
ID: 40394886
Practically this gonna work for you unless you don't have any issue with WMI access to all all server. If any Opaddition error can be avoided by making $results as array as below

[array]$results += Get-WmiObject Win32_ComputerSystemProduct -ComputerName $computer| Select @{Name="Computer Name";Expression={$computer}},Vendor,Name,IdentifyingNumber

if any WMI error for me below comment works perfect for me

"Invoke-Command {Get-WmiObject Win32_ComputerSystemProduct} -computer $computer"
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
A procedure for exporting installed hotfix details of remote computers using powershell
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now