?
Solved

Active Directory Inventory

Posted on 2014-10-20
3
Medium Priority
?
130 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Assisted Solution

by:Joshua Grantom
Joshua Grantom earned 1000 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 1000 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

Need protection from advanced malware attacks?

Look no further than WatchGuard's Total Security Suite, providing defense in depth against today's most headlining attacks like Petya 2.0 and WannaCry. Keep your organization out of the news with protection from known and unknown threats.

Question has a verified solution.

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

After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

762 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