?
Solved

Dell and HP Serial Number/Service Tag

Posted on 2014-10-17
16
Medium Priority
?
1,289 Views
Last Modified: 2016-11-23
how do i command line into the boxes and retrieve hardware information and service tag number/serial number

i have access to the box just have many rather do them from my laptop
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
  • 5
  • 5
  • 3
  • +2
16 Comments
 
LVL 9

Expert Comment

by:David Carr
ID: 40386788
Go to Start then Run and type cmd to start your command prompt.

type wmic csproduct get vendor,name,identifyingnumber


 and to save it in a text file add > c:\servicetag.txt to the end of the above line
0
 
LVL 2

Author Comment

by:Jorge Ocampo
ID: 40386807
but that would have to be done on the actual server what about remote cmd?
0
 
LVL 1

Expert Comment

by:Gilbert Gonzalez
ID: 40386998
Jorge,

What David said should work even if you remote into each computer. Just remote into each one, run the CMD, and type the command that David specified (wmic csproduct get vendor,name,identifyingnumber). And as David specified if you want to create a text file so you don't have to copy the information from the CMD prompt, just do the following:

wmic csproduct get vendor,name,identifyingnumber > c:\hardwareinfo.txt

Where "c:\hardwareinfo.txt" can be any path you choose and any file name you would like to have. If they are all within the same network and you have a shared network drive you can specify that path instead so you can have them all in the same place. But remember to use the Fully Qualified name for the path (\\servername\sharename\filename.txt).

Hope this helps clarify further what David explained.

Any questions just let us know.
0
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 2

Author Comment

by:Jorge Ocampo
ID: 40387008
yes i got that part guys what i meant is how do i do a remote cmd not rdp into the machine
0
 
LVL 9

Expert Comment

by:David Carr
ID: 40387027
You can use wmic /user:youraccount /node:ip bios get serialnumber
   You will be prompted for the password for youraccount. Enter remote server's ip  after /node. If you use the remote server's hostname you have to use " around the name. e.g. wmic /user:youraccount /node:"server-name" bios get serialnumber
0
 
LVL 40

Expert Comment

by:footech
ID: 40387120
If you're interested in PowerShell, the equivalent of the wmic command is
Get-WmiObject Win32_ComputerSystemProduct | Select Vendor,Name,IdentifyingNumber

You can loop through a list of computers with
Get-Content computers.txt | ForEach { Get-WmiObject Win32_ComputerSystemProduct -ComputerName $_ } | Select Vendor,Name,IdentifyingNumber

Open in new window

where computers.txt contains a list of the computers you want to query (one name per line).
0
 
LVL 16

Expert Comment

by:Joshua Grantom
ID: 40391973
Or you could get Vendor, Model Name, and Serial/Service Tag for every computer on your network or adjust Get-ADComputer to get what you want.

This will export to a CSV with the computer name as well
$computers = Get-ADComputer -Filter *
foreach ($computer in $computers) { 
Get-WmiObject Win32_ComputerSystemProduct -ComputerName $computer| Select @{Name="Computer Name";Expression={Get-ADComputer $computer | Select Name}},Vendor,Name,IdentifyingNumber | Export-CSV C:\ComputerInfo.csv -nti
}

Open in new window


This will use the list option
$computers = GC C:\computerlist.txt
foreach ($computer in $computers) { 
Get-WmiObject Win32_ComputerSystemProduct -ComputerName $computer| Select @{Name="Computer Name";Expression={Get-ADComputer $computer | Select Name}},Vendor,Name,IdentifyingNumber | Export-CSV C:\ComputerInfo.csv -nti
}

Open in new window

0
 
LVL 2

Author Comment

by:Jorge Ocampo
ID: 40392811
joshua where could i filter the OU that i want it to search through since i only care about servers
0
 
LVL 16

Expert Comment

by:Joshua Grantom
ID: 40392828
You can just add searchbase
$results = @()
$computers = (Get-ADComputer -Filter * -SearchBase "OU=Servers,CN=Computers,DC=yourdomain,DC=com").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

Open in new window


or you can filter by operating system name (Enabled computers with server in OS name)

$results = @()
$computers = (Get-ADComputer -Filter {Enabled -eq $True -and OperatingSystem -like "*server*"}).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

Open in new window

0
 
LVL 2

Author Comment

by:Jorge Ocampo
ID: 40392852
can it be so it exports to cvs?
0
 
LVL 16

Expert Comment

by:Joshua Grantom
ID: 40392858
I made a few corrections on my last post and it does export to CSV
0
 
LVL 40

Expert Comment

by:footech
ID: 40392863
@Joshua Grantom - Your examples include some unnecessary lookups and syntax/logic errors.
In the first one the simplest fix would be to modify line 1 to be
$computers = Get-ADComputer -Filter * | Select -expand Name
Then your WMI query will actually work.  Next when you're getting the computer name, there's no reason to do another query to AD, you already have the info (in $computer or could just use the PSComputerName property returned from the WMI query).  Lastly, since you're calling Export-CSV within a loop, you either need to have a unique filename for each loop, or use the -append parameter to avoid repeatedly overwriting the file (available with PS 3.0+).  You could avoid that with having Export-CSV outside a loop (for example by piping from the foreach-object cmdlet).
Get-Content computers.txt | ForEach { Get-WmiObject Win32_ComputerSystemProduct -ComputerName $_ } |
 Select PSComputerName,Vendor,Name,IdentifyingNumber | Export-CSV compinfo.csv -notype

Open in new window


EDIT:  I just saw that you've made some modifications which correct some of what I mentioned.
0
 
LVL 16

Expert Comment

by:Joshua Grantom
ID: 40392872
Hey footech,

Thanks, my second posts made some changes, I realized that I was querying the same thing again as well as the export-csv not being outside the loop
0
 
LVL 2

Author Comment

by:Jorge Ocampo
ID: 40392890
Joshua i see you are not filtering anymore is that right?
0
 
LVL 16

Accepted Solution

by:
Joshua Grantom earned 2000 total points
ID: 40392905
I'm not sure what you are referring to Jorge?

To choose a specific OU this is what you would use
$results = @()
$computers = (Get-ADComputer -Filter * -SearchBase "OU=Servers,CN=Computers,DC=yourdomain,DC=com").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

Open in new window

0
 
LVL 40

Expert Comment

by:footech
ID: 40393421
It would have been appropriate to accept http:#a40387120 as an assist, as that was the first to give the main PowerShell code for retrieving the info from whatever remote servers you wish.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

752 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