There are a lot of posts about pulling data from a file to do actions against computers/users. While this is valuable, I prefer to do dynamic capturing of computer and user objects directly from my Active Directory.
This is a simple script which will capture a list of computers from Active Directory and subsequently pull the serial number using the Get-WMIObject CmdLet using the Win32_BIOS class.
The neat addition over many other scripts I have used is the addition of the -ErrorAction SilentlyContinue option which prevents offline computers from sending error information in the output. Add some error handling and you now have a list of computers which are offline or inaccessible.
As with many of the scripts I will show you, you need to install ActiveRoles CmdLets from Quest Software (follow the link in the Gist)
Here’s the code: http://gist.github.com/492475
List of serial numbers from Active Directory computers