Solved

Active Directory Inventory

Posted on 2014-10-20
3
115 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article will help you understand what HashTables are and how to use them in 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 from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
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 …

705 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

19 Experts available now in Live!

Get 1:1 Help Now