Solved

Dell and HP Serial Number/Service Tag

Posted on 2014-10-17
16
767 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
  • 5
  • 5
  • 3
  • +2
16 Comments
 
LVL 9

Expert Comment

by:David Carr
Comment Utility
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
Comment Utility
but that would have to be done on the actual server what about remote cmd?
0
 
LVL 1

Expert Comment

by:Gilbert Gonzalez
Comment Utility
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
 
LVL 2

Author Comment

by:Jorge Ocampo
Comment Utility
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
Comment Utility
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 39

Expert Comment

by:footech
Comment Utility
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
Comment Utility
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
Comment Utility
joshua where could i filter the OU that i want it to search through since i only care about servers
0
Free Trending Threat Insights Every Day

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.

 
LVL 16

Expert Comment

by:Joshua Grantom
Comment Utility
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
Comment Utility
can it be so it exports to cvs?
0
 
LVL 16

Expert Comment

by:Joshua Grantom
Comment Utility
I made a few corrections on my last post and it does export to CSV
0
 
LVL 39

Expert Comment

by:footech
Comment Utility
@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
Comment Utility
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
Comment Utility
Joshua i see you are not filtering anymore is that right?
0
 
LVL 16

Accepted Solution

by:
Joshua Grantom earned 500 total points
Comment Utility
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 39

Expert Comment

by:footech
Comment Utility
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

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

How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

763 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

6 Experts available now in Live!

Get 1:1 Help Now