{"id":2693,"date":"2018-11-02T23:40:48","date_gmt":"2018-11-02T23:40:48","guid":{"rendered":"http:\/\/microsoftgeek.com\/?p=2693"},"modified":"2018-11-02T23:40:48","modified_gmt":"2018-11-02T23:40:48","slug":"how-to-get-the-serial-number-of-a-remote-computer-using-powershell","status":"publish","type":"post","link":"https:\/\/microsoftgeek.com\/?p=2693","title":{"rendered":"How to Get the Serial Number of a Remote Computer Using PowerShell"},"content":{"rendered":"<div class=\"article_content\">\n<div class=\"article_user-content user-content\">\n<h2 class=\"user-content_title title -h2 \">Retrieving the Serial Number from a Local Computer<\/h2>\n<p class=\"user-content_text text \">The\u00a0<span style=\"color: #99cc00;\"><i>get-ciminstance<\/i><\/span>\u00a0PowerShell command was introduced in PowerShell 3.0. It allows administrators to run WMI queries on local or remote computers. To retrieve the BIOS serial number of the local computer, we need to access the\u00a0<i>Win32_BIOS<\/i>WMI class.<\/p>\n<p class=\"user-content_text text \">Log on to Windows Server 2012 R2, click the\u00a0<b>PowerShell<\/b>\u00a0icon on the desktop taskbar. In the prompt window, run the following command:<\/p>\n<div id=\"crayon-5bdce0345452e663962792\" class=\"crayon-syntax crayon-theme-1c-zapros crayon-font-monaco crayon-os-pc print-yes notranslate\" data-settings=\" minimize scroll-mouseover\">\n<div class=\"crayon-toolbar\" data-settings=\" show\">\n<div class=\"crayon-tools\">\n<div class=\"crayon-button crayon-nums-button crayon-pressed\" title=\"Toggle Line Numbers\"><\/div>\n<div class=\"crayon-button crayon-wrap-button\" title=\"Toggle Line Wrap\"><\/div>\n<div class=\"crayon-button crayon-popup-button\" title=\"Open Code In New Window\"><\/div>\n<p><span class=\"crayon-language\" style=\"color: #99cc00;\">PowerShell<\/span><\/div>\n<\/div>\n<div class=\"crayon-plain-wrap\"><span style=\"color: #99cc00;\">\u00a0<\/span><\/div>\n<div class=\"crayon-main\">\n<table class=\"crayon-table\">\n<tbody>\n<tr class=\"crayon-row\">\n<td class=\"crayon-nums \" data-settings=\"show\">\n<div class=\"crayon-nums-content\">\n<div class=\"crayon-num\" data-line=\"crayon-5bdce0345452e663962792-1\"><span style=\"color: #99cc00;\">1<\/span><\/div>\n<\/div>\n<\/td>\n<td class=\"crayon-code\">\n<div class=\"crayon-pre\">\n<div id=\"crayon-5bdce0345452e663962792-1\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-i\">get<\/span><span class=\"crayon-cn\">-ciminstance<\/span> <span class=\"crayon-i\">win32_bios<\/span><\/span><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>To display only the serial number, type:<\/p>\n<div id=\"crayon-5bdce03454535263491463\" class=\"crayon-syntax crayon-theme-1c-zapros crayon-font-monaco crayon-os-pc print-yes notranslate\" data-settings=\" minimize scroll-mouseover\">\n<div class=\"crayon-toolbar\" data-settings=\" show\">\n<div class=\"crayon-tools\">\n<div class=\"crayon-button crayon-nums-button crayon-pressed\" title=\"Toggle Line Numbers\"><\/div>\n<div class=\"crayon-button crayon-wrap-button\" title=\"Toggle Line Wrap\"><\/div>\n<div class=\"crayon-button crayon-popup-button\" title=\"Open Code In New Window\"><\/div>\n<p><span class=\"crayon-language\" style=\"color: #99cc00;\">PowerShell<\/span><\/div>\n<\/div>\n<div class=\"crayon-plain-wrap\"><span style=\"color: #99cc00;\">\u00a0<\/span><\/div>\n<div class=\"crayon-main\">\n<table class=\"crayon-table\">\n<tbody>\n<tr class=\"crayon-row\">\n<td class=\"crayon-nums \" data-settings=\"show\">\n<div class=\"crayon-nums-content\">\n<div class=\"crayon-num\" data-line=\"crayon-5bdce03454535263491463-1\"><span style=\"color: #99cc00;\">1<\/span><\/div>\n<\/div>\n<\/td>\n<td class=\"crayon-code\">\n<div class=\"crayon-pre\">\n<div id=\"crayon-5bdce03454535263491463-1\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-i\">get<\/span><span class=\"crayon-cn\">-ciminstance<\/span> <span class=\"crayon-i\">win32_bios<\/span> <span class=\"crayon-o\">|<\/span> <span class=\"crayon-r \">format-list<\/span> <span class=\"crayon-i\">serialnumber<\/span><\/span><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><img class=\"_js size-full wp-image-48060 alignnone\" title=\"Using PowerShell and WMI to get the serial number of a computer\" sizes=\"(max-width: 580px) 100vw, 580px\" srcset=\"https:\/\/www.petri.com\/wp-content\/uploads\/sites\/3\/Figure1149.jpg 580w, https:\/\/www.petri.com\/wp-content\/uploads\/sites\/3\/Figure1149-300x106.jpg 300w\" alt=\"Using PowerShell and WMI to get the serial number of a computer\" width=\"580\" height=\"204\" \/><\/p>\n<h2 class=\"user-content_title title -h2 \">Retrieving the Serial Number from a Remote Computer<\/h2>\n<p class=\"user-content_text text \">The\u00a0<i>get-ciminstance<\/i>\u00a0cmdlet creates a temporary session to remote computers using the WSMAN protocol over HTTP. Windows Remote Management (WINRM) is enabled by default in Windows Server 2012 R2. If it is not enabled on the remote computer you want to query, or the default WINRM listener has been deleted, run\u00a0<span style=\"color: #99cc00;\"><b>winrm qc<\/b><\/span>\u00a0at an elevated command prompt on the remote device to add the default listener.<\/p>\n<div id=\"crayon-5bdce03454537207757467\" class=\"crayon-syntax crayon-theme-1c-zapros crayon-font-monaco crayon-os-pc print-yes notranslate\" data-settings=\" minimize scroll-mouseover\">\n<div class=\"crayon-toolbar\" data-settings=\" show\">\n<div class=\"crayon-tools\">\n<div class=\"crayon-button crayon-nums-button crayon-pressed\" title=\"Toggle Line Numbers\"><\/div>\n<div class=\"crayon-button crayon-wrap-button\" title=\"Toggle Line Wrap\"><\/div>\n<div class=\"crayon-button crayon-popup-button\" title=\"Open Code In New Window\"><\/div>\n<p><span class=\"crayon-language\" style=\"color: #99cc00;\">PowerShell<\/span><\/div>\n<\/div>\n<div class=\"crayon-plain-wrap\"><span style=\"color: #99cc00;\">\u00a0<\/span><\/div>\n<div class=\"crayon-main\">\n<table class=\"crayon-table\">\n<tbody>\n<tr class=\"crayon-row\">\n<td class=\"crayon-nums \" data-settings=\"show\">\n<div class=\"crayon-nums-content\">\n<div class=\"crayon-num\" data-line=\"crayon-5bdce03454537207757467-1\"><span style=\"color: #99cc00;\">1<\/span><\/div>\n<\/div>\n<\/td>\n<td class=\"crayon-code\">\n<div class=\"crayon-pre\">\n<div id=\"crayon-5bdce03454537207757467-1\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-i\">get<\/span><span class=\"crayon-cn\">-ciminstance<\/span> <span class=\"crayon-cn\">-classname<\/span> <span class=\"crayon-i\">win32_bios<\/span> <span class=\"crayon-cn\">-computername<\/span> <span class=\"crayon-i\">contososrv1<\/span> <span class=\"crayon-o\">|<\/span> <span class=\"crayon-r \">format-list<\/span> <span class=\"crayon-i\">serialnumber<\/span><\/span><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>After\u00a0<i>\u2013computername\u00a0<\/i>in the example above, replace\u00a0<i>contososrv1<\/i>\u00a0with the name of the remote server you want to query.<\/p>\n<p>&nbsp;<\/p>\n<h2 class=\"user-content_title title -h2 \">Windows Server 2003 and XP<\/h2>\n<p class=\"user-content_text text \">The above commands should work if the remote computer is Windows 2008, Vista or later. To query Windows Server 2003 or XP, we need to configure a session that uses the DCOM protocol instead of WSMAN.<\/p>\n<p class=\"user-content_text text \">Run the following three commands in a PowerShell prompt to retrieve the serial number from a remote Windows Server 2003 computer, replacing\u00a0<i>contososrv1<\/i>\u00a0with the name of the remote server:<\/p>\n<div id=\"crayon-5bdce0345453a031919848\" class=\"crayon-syntax crayon-theme-1c-zapros crayon-font-monaco crayon-os-pc print-yes notranslate\" data-settings=\" minimize scroll-mouseover\">\n<div class=\"crayon-toolbar\" data-settings=\" show\">\n<div class=\"crayon-tools\">\n<div class=\"crayon-button crayon-nums-button crayon-pressed\" title=\"Toggle Line Numbers\"><\/div>\n<div class=\"crayon-button crayon-wrap-button\" title=\"Toggle Line Wrap\"><\/div>\n<div class=\"crayon-button crayon-popup-button\" title=\"Open Code In New Window\"><\/div>\n<p><span class=\"crayon-language\" style=\"color: #99cc00;\">PowerShell<\/span><\/div>\n<\/div>\n<div class=\"crayon-plain-wrap\"><span style=\"color: #99cc00;\">\u00a0<\/span><\/div>\n<div class=\"crayon-main\">\n<table class=\"crayon-table\">\n<tbody>\n<tr class=\"crayon-row\">\n<td class=\"crayon-nums \" data-settings=\"show\">\n<div class=\"crayon-nums-content\">\n<div class=\"crayon-num\" data-line=\"crayon-5bdce0345453a031919848-1\"><span style=\"color: #99cc00;\">1<\/span><\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdce0345453a031919848-2\"><span style=\"color: #99cc00;\">2<\/span><\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdce0345453a031919848-3\"><span style=\"color: #99cc00;\">3<\/span><\/div>\n<\/div>\n<\/td>\n<td class=\"crayon-code\">\n<div class=\"crayon-pre\">\n<div id=\"crayon-5bdce0345453a031919848-1\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-v\">$sessionoption<\/span> <span class=\"crayon-o\">=<\/span> <span class=\"crayon-i\">new<\/span><span class=\"crayon-cn\">-cimsessionoption<\/span> <span class=\"crayon-cn\">-protocol<\/span> <span class=\"crayon-i\">dcom<\/span><\/span><\/div>\n<div id=\"crayon-5bdce0345453a031919848-2\" class=\"crayon-line crayon-striped-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-v\">$cimsession<\/span> <span class=\"crayon-o\">=<\/span> <span class=\"crayon-i\">new<\/span><span class=\"crayon-cn\">-cimsession<\/span> <span class=\"crayon-cn\">-sessionoption<\/span> <span class=\"crayon-v\">$sessionoption<\/span> <span class=\"crayon-cn\">-computername<\/span> <span class=\"crayon-e\">contososrv1<\/span><\/span><\/div>\n<div id=\"crayon-5bdce0345453a031919848-3\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-i\">get<\/span><span class=\"crayon-cn\">-ciminstance<\/span> <span class=\"crayon-i\">win32_bios<\/span> <span class=\"crayon-cn\">-cimsession<\/span> <span class=\"crayon-v\">$cimsession<\/span><\/span><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<footer class=\"article_footer\">\n<p class=\"article_text text\">\n<\/footer>\n","protected":false},"excerpt":{"rendered":"<p>Retrieving the Serial Number from a Local Computer The\u00a0get-ciminstance\u00a0PowerShell command was introduced in PowerShell 3.0. It allows administrators to run WMI queries on local or remote computers. To retrieve the BIOS serial number of the local computer, we need to access the\u00a0Win32_BIOSWMI class. Log on to Windows Server 2012 R2, click the\u00a0PowerShell\u00a0icon on the desktop [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59],"tags":[],"class_list":["post-2693","post","type-post","status-publish","format-standard","hentry","category-powershell"],"_links":{"self":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/2693","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2693"}],"version-history":[{"count":1,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/2693\/revisions"}],"predecessor-version":[{"id":2694,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/2693\/revisions\/2694"}],"wp:attachment":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}