Solved

Active Directory Inventory

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
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 from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

810 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