Get List of Serial Numbers of all Domain Computers

baleman2
baleman2 used Ask the Experts™
on
I'm working from a Windows 7 computer connected to our domain via a VPN.
I'd like to get a list of the serial numbers of ALL computers currently running in our domain.  I'm assuming this would be done from accessing information via Active Directory.
Can a powershell command be run from my Windows 7 computer or must I run the command from the Domain Controller itself?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Are you referring to the hardware serial number of the computer?
Nathan HawkinsTechnical Lead - Network Security

Commented:
I am assuming you mean the Windows server keys used to activate Windows server, and not the hardware manufacturers serial number.

In either case I am not sure how you can run ANY command that would accomplish either.

You can go into AD Users and Computers > The domain you want to see > Computers and this is the list of all the computers that are in that domain who are in your AD.

So out of curiosity I clicked on one of the computers in my AD computers group clicked on the "Attribute Editor" tab and scrolled to "serialNumber" and I'll be a **** **** **** that there is an object just for that, however you would had to have already previously set that in order for it to be filled otherwise it will be "<not set>"
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
To Nathan:
My AD OU named Computers populates with what you described.  The attribute is <not set>.
It is that serial number that I need to retrieve - not for just 1 computer but for all computers in our domain.
I was hoping to find a PowerShell command that would work.

To 65td:
Your link provided me with some PowerShell commands, but it looks as though I need to know the HostName of the computer before I can retrieve the serial number, as in:
Get-WMIObject -Class Win32_BIOS -ComputerName DomCon1 | Format-List SerialNumber
The above command provided me only with the serial number of DomCon1
Top Expert 2016

Commented:
$computers = get-adcomputer -filter * | select-object -expandproperty Name
foreach ($computer in $computers) {
$serial = Get-WMIObject -Class Win32_BIOS -ComputerName $computer | select-object -expandproperty  SerialNumber
write-output ("Computer {0} Serial Number: {1}" -f $computer,$serial)
}

Open in new window

Author

Commented:
To David:
This exact command can be copied/pasted at my powershell prompt - no changes necessary?  If so:
1) Can it be run from my own pc . . .or,
2) Must it be run from the powershell on the Domain Controller itself?
Nathan HawkinsTechnical Lead - Network Security

Commented:
Yeah. You would need some sort of 3rd party tool to populate that object so that you could then run that/those power shell command/s to query a DC and get every computer and that object's value, which is why I said initally I dont know of any Windows command that will populate that field and then a command to then query the newly populated fields and give you that list.

The second part I was pretty sure some AD script guru would be able to cobble something together, but its pretty useless if that field wasn't already populated (as seems to be the case).
Top Expert 2016

Commented:
paste it into your ISE  It should run from any computer that has the activedirectory module (rsat tools installed) otherwise run it from any dc

Author

Commented:
To David:
Apologies to you, but:
The only acronym I associate with ISE is Cisco's "Identity Services Engine".  What exactly do you mean "paste it into your ISE"?
Top Expert 2016
Commented:
We are talking Powershell here so if you search for powershell ISE It is the Integrated Scripting Environment which is the powershell editor .. My top hit is https://docs.microsoft.com/en-us/powershell/scripting/components/ise/introducing-the-windows-powershell-ise?view=powershell-6 you can launch it directly from the start menu, or within powershell type ise

Author

Commented:
So sorry that I left the results of David's suggestions unanswered.  His solution was the perfect solution to my question.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial