<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Powershell PC Info Script (WMI)</title>
	<atom:link href="http://www.hackyeah.com/2010/08/powershell-pc-info-script-wmi/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hackyeah.com/2010/08/powershell-pc-info-script-wmi/</link>
	<description>InfoSec, Design, Etc...</description>
	<lastBuildDate>Wed, 09 May 2012 14:55:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Larry Arndorfer</title>
		<link>http://www.hackyeah.com/2010/08/powershell-pc-info-script-wmi/#comment-482</link>
		<dc:creator>Larry Arndorfer</dc:creator>
		<pubDate>Tue, 24 May 2011 14:09:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackyeah.com/?p=122#comment-482</guid>
		<description>Trenton,

JAmes and I have made a couple changes to the Monitor section of your script. We exported a list of Laptops out od AD to run in the script. We also only wanted the monitor that are currenty connected. We think that the ones whit a control key are the monitor currentl connected. Let us know what you think.

Thanks
Larry

#    ***********************************************
#   *  FindMonitor FindMonitorSN.PS1                *
#  *   Find Monitor Serial Number                    *
#  *   Creaters: Larry Arndorfer &amp; James Hunt        *
#   *  Revisions: 2011-05-23 Created                *
#    ***********************************************

Clear-Host

function Pause ($Message=&quot;Press any key to continue...&quot;){
    &quot;&quot;
    Write-Host $Message
    $null = $Host.UI.RawUI.ReadKey(&quot;NoEcho,IncludeKeyDown&quot;)
}

function GetCompName{
$list = Import-Csv &quot;C:\AD_Laptops.csv&quot; -Header &quot;Laptops&quot;

foreach($compname in $list)
{
    $compname = $($compname.Laptops)
	CheckHost
}	
}

function CheckHost{
    $ping = gwmi Win32_PingStatus -filter &quot;Address=&#039;$compname&#039;&quot;
    if($ping.StatusCode -eq 0){$pcip=$ping.ProtocolAddress; GetInfo}
    else{&quot;$compname down&quot;}
}

function GetInfo{

#	*********  Monitor Info  ************

		#Turn off Error Messages
		$ErrorActionPreference_Backup = $ErrorActionPreference
		$ErrorActionPreference = &quot;SilentlyContinue&quot;

		$keytype=[Microsoft.Win32.RegistryHive]::LocalMachine
		if($reg=[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($keytype,$compname)){
			#Create Table To Hold Info
			$montable = New-Object system.Data.DataTable &quot;Monitor Info&quot;
			#Create Columns for Table
			$moncol1 = New-Object system.Data.DataColumn Model,([string])
			$moncol2 = New-Object system.Data.DataColumn Serial,([string])
			$moncol3 = New-Object system.Data.DataColumn Ascii,([string])
			$moncol4 = New-Object system.Data.DataColumn Computer,([string])
			#Add Columns to Table
			$montable.columns.add($moncol1)
			$montable.columns.add($moncol2)
			$montable.columns.add($moncol3)
			$montable.columns.add($moncol4)

			$regKey= $reg.OpenSubKey(&quot;SYSTEM\\CurrentControlSet\\Enum\DISPLAY&quot; )
			$HID = $regkey.GetSubKeyNames()
			foreach($HID_KEY_NAME in $HID){
				$regKey= $reg.OpenSubKey(&quot;SYSTEM\\CurrentControlSet\\Enum\\DISPLAY\\$HID_KEY_NAME&quot; )
				$DID1 = $regkey.GetSubKeyNames()
				foreach($DID_KEY_NAME in $DID1){
					$CheckActive = &quot;False&quot;
					$regKey2=$reg.OpenSubKey(&quot;SYSTEM\\CurrentControlSet\\Enum\\DISPLAY\\$HID_KEY_NAME\\$DID_KEY_NAME&quot;)
					$DID2=$regKey2.GetSubKeyNames()
					foreach($DID2_KEY_NAME in $DID2){
						If($DID2_KEY_NAME -EQ &quot;Control&quot;){
							$regKey= $reg.OpenSubKey(&quot;SYSTEM\\CurrentControlSet\\Enum\\DISPLAY\\$HID_KEY_NAME\\$DID_KEY_NAME\\Device Parameters&quot; )
							$EDID = $regKey.GetValue(&quot;EDID&quot;)
							foreach($int in $EDID){
								$EDID_String = $EDID_String+([char]$int)
							}
							#Create new row in table
							$monrow=$montable.NewRow()

							#ComputerName
							$monrow.Computer = $compname
							
							#MonitorName
							$checkstring = [char]0x00 + [char]0x00 + [char]0x00 + [char]0xFC + [char]0x00
							$matchfound = $EDID_String -match &quot;$checkstring([\w ]+)&quot;
							if($matchfound){$monrow.Model = [string]$matches[1]} else {$monrow.Model = &#039;-&#039;}

							#Serial Number
							$checkstring = [char]0x00 + [char]0x00 + [char]0x00 + [char]0xFF + [char]0x00
							$matchfound =  $EDID_String -match &quot;$checkstring(\S+)&quot;
							if($matchfound){$monrow.Serial = [string]$matches[1]} else {$monrow.Serial = &#039;-&#039;}

							#AsciiString
							$checkstring = [char]0x00 + [char]0x00 + [char]0x00 + [char]0xFE + [char]0x00
							$matchfound = $EDID_String -match &quot;$checkstring([\w ]+)&quot;
							if($matchfound){$monrow.Ascii = [string]$matches[1]} else {$monrow.Ascii = &#039;-&#039;}         

							$EDID_String = &#039;&#039;

							$montable.Rows.Add($monrow)
						}
					}
				}
			}
			$montable &#124; select-object  -unique Computer,Serial,Model,Ascii &#124; Where-Object {$_.Serial -ne &quot;-&quot;} &#124; Format-Table
		} else {
			Write-Host &quot;Access Denied - Check Permissions&quot;
		}
		$ErrorActionPreference = $ErrorActionPreference_Backup #Reset Error Messages
		#Pause
		#CheckHost
	  }
	
 

#---------Start Main--------------
$compname = $args[0]
if($compname){CheckHost}
else{GetCompName}</description>
		<content:encoded><![CDATA[<p>Trenton,</p>
<p>JAmes and I have made a couple changes to the Monitor section of your script. We exported a list of Laptops out od AD to run in the script. We also only wanted the monitor that are currenty connected. We think that the ones whit a control key are the monitor currentl connected. Let us know what you think.</p>
<p>Thanks<br />
Larry</p>
<p>#    ***********************************************<br />
#   *  FindMonitor FindMonitorSN.PS1                *<br />
#  *   Find Monitor Serial Number                    *<br />
#  *   Creaters: Larry Arndorfer &amp; James Hunt        *<br />
#   *  Revisions: 2011-05-23 Created                *<br />
#    ***********************************************</p>
<p>Clear-Host</p>
<p>function Pause ($Message=&#8221;Press any key to continue&#8230;&#8221;){<br />
    &#8220;&#8221;<br />
    Write-Host $Message<br />
    $null = $Host.UI.RawUI.ReadKey(&#8220;NoEcho,IncludeKeyDown&#8221;)<br />
}</p>
<p>function GetCompName{<br />
$list = Import-Csv &#8220;C:\AD_Laptops.csv&#8221; -Header &#8220;Laptops&#8221;</p>
<p>foreach($compname in $list)<br />
{<br />
    $compname = $($compname.Laptops)<br />
	CheckHost<br />
}<br />
}</p>
<p>function CheckHost{<br />
    $ping = gwmi Win32_PingStatus -filter &#8220;Address=&#8217;$compname&#8217;&#8221;<br />
    if($ping.StatusCode -eq 0){$pcip=$ping.ProtocolAddress; GetInfo}<br />
    else{&#8220;$compname down&#8221;}<br />
}</p>
<p>function GetInfo{</p>
<p>#	*********  Monitor Info  ************</p>
<p>		#Turn off Error Messages<br />
		$ErrorActionPreference_Backup = $ErrorActionPreference<br />
		$ErrorActionPreference = &#8220;SilentlyContinue&#8221;</p>
<p>		$keytype=[Microsoft.Win32.RegistryHive]::LocalMachine<br />
		if($reg=[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($keytype,$compname)){<br />
			#Create Table To Hold Info<br />
			$montable = New-Object system.Data.DataTable &#8220;Monitor Info&#8221;<br />
			#Create Columns for Table<br />
			$moncol1 = New-Object system.Data.DataColumn Model,([string])<br />
			$moncol2 = New-Object system.Data.DataColumn Serial,([string])<br />
			$moncol3 = New-Object system.Data.DataColumn Ascii,([string])<br />
			$moncol4 = New-Object system.Data.DataColumn Computer,([string])<br />
			#Add Columns to Table<br />
			$montable.columns.add($moncol1)<br />
			$montable.columns.add($moncol2)<br />
			$montable.columns.add($moncol3)<br />
			$montable.columns.add($moncol4)</p>
<p>			$regKey= $reg.OpenSubKey(&#8220;SYSTEM\\CurrentControlSet\\Enum\DISPLAY&#8221; )<br />
			$HID = $regkey.GetSubKeyNames()<br />
			foreach($HID_KEY_NAME in $HID){<br />
				$regKey= $reg.OpenSubKey(&#8220;SYSTEM\\CurrentControlSet\\Enum\\DISPLAY\\$HID_KEY_NAME&#8221; )<br />
				$DID1 = $regkey.GetSubKeyNames()<br />
				foreach($DID_KEY_NAME in $DID1){<br />
					$CheckActive = &#8220;False&#8221;<br />
					$regKey2=$reg.OpenSubKey(&#8220;SYSTEM\\CurrentControlSet\\Enum\\DISPLAY\\$HID_KEY_NAME\\$DID_KEY_NAME&#8221;)<br />
					$DID2=$regKey2.GetSubKeyNames()<br />
					foreach($DID2_KEY_NAME in $DID2){<br />
						If($DID2_KEY_NAME -EQ &#8220;Control&#8221;){<br />
							$regKey= $reg.OpenSubKey(&#8220;SYSTEM\\CurrentControlSet\\Enum\\DISPLAY\\$HID_KEY_NAME\\$DID_KEY_NAME\\Device Parameters&#8221; )<br />
							$EDID = $regKey.GetValue(&#8220;EDID&#8221;)<br />
							foreach($int in $EDID){<br />
								$EDID_String = $EDID_String+([char]$int)<br />
							}<br />
							#Create new row in table<br />
							$monrow=$montable.NewRow()</p>
<p>							#ComputerName<br />
							$monrow.Computer = $compname</p>
<p>							#MonitorName<br />
							$checkstring = [char]0&#215;00 + [char]0&#215;00 + [char]0&#215;00 + [char]0xFC + [char]0&#215;00<br />
							$matchfound = $EDID_String -match &#8220;$checkstring([\w ]+)&#8221;<br />
							if($matchfound){$monrow.Model = [string]$matches[1]} else {$monrow.Model = &#8216;-&#8217;}</p>
<p>							#Serial Number<br />
							$checkstring = [char]0&#215;00 + [char]0&#215;00 + [char]0&#215;00 + [char]0xFF + [char]0&#215;00<br />
							$matchfound =  $EDID_String -match &#8220;$checkstring(\S+)&#8221;<br />
							if($matchfound){$monrow.Serial = [string]$matches[1]} else {$monrow.Serial = &#8216;-&#8217;}</p>
<p>							#AsciiString<br />
							$checkstring = [char]0&#215;00 + [char]0&#215;00 + [char]0&#215;00 + [char]0xFE + [char]0&#215;00<br />
							$matchfound = $EDID_String -match &#8220;$checkstring([\w ]+)&#8221;<br />
							if($matchfound){$monrow.Ascii = [string]$matches[1]} else {$monrow.Ascii = &#8216;-&#8217;}         </p>
<p>							$EDID_String = &#8221;</p>
<p>							$montable.Rows.Add($monrow)<br />
						}<br />
					}<br />
				}<br />
			}<br />
			$montable | select-object  -unique Computer,Serial,Model,Ascii | Where-Object {$_.Serial -ne &#8220;-&#8221;} | Format-Table<br />
		} else {<br />
			Write-Host &#8220;Access Denied &#8211; Check Permissions&#8221;<br />
		}<br />
		$ErrorActionPreference = $ErrorActionPreference_Backup #Reset Error Messages<br />
		#Pause<br />
		#CheckHost<br />
	  }</p>
<p>#&#8212;&#8212;&#8212;Start Main&#8212;&#8212;&#8212;&#8212;&#8211;<br />
$compname = $args[0]<br />
if($compname){CheckHost}<br />
else{GetCompName}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loriann Phillies</title>
		<link>http://www.hackyeah.com/2010/08/powershell-pc-info-script-wmi/#comment-480</link>
		<dc:creator>Loriann Phillies</dc:creator>
		<pubDate>Wed, 11 May 2011 15:38:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackyeah.com/?p=122#comment-480</guid>
		<description>I do like things nice and easy. I found something that is just like that Easy Button that they advertise on TV for Staples. This technology was secretly &quot;copied&quot; from one of the top internet enterprises. The fact is, that this software is 100% legal, &quot;white hat&quot; and ethical, that even giant enterprises use it. And the best part - it is really running on full autopilot. This super affiliate push button software is the real thing, so if you&#039;re planning to use it unethically, or use it for scam purposes, this software isn&#039;t for you! If you can spend no more than 3 minutes to download and setup this software, and then click the &#039;Start Button&#039; just once to start this autopilot push button software... Then you can make money online. This never seen before push button software proved that the best and most profitable traffic on the internet is free traffic. You might be tempted to try to disect this software in order to &#039;see the magic&#039; but why bother? All you really need to know is that you can download it (if the link hasn&#039;t been taken down yet) and then push a button and watch the magic. Try it out -&gt; http://adf.ly/1TyCy</description>
		<content:encoded><![CDATA[<p>I do like things nice and easy. I found something that is just like that Easy Button that they advertise on TV for Staples. This technology was secretly &#8220;copied&#8221; from one of the top internet enterprises. The fact is, that this software is 100% legal, &#8220;white hat&#8221; and ethical, that even giant enterprises use it. And the best part &#8211; it is really running on full autopilot. This super affiliate push button software is the real thing, so if you&#8217;re planning to use it unethically, or use it for scam purposes, this software isn&#8217;t for you! If you can spend no more than 3 minutes to download and setup this software, and then click the &#8216;Start Button&#8217; just once to start this autopilot push button software&#8230; Then you can make money online. This never seen before push button software proved that the best and most profitable traffic on the internet is free traffic. You might be tempted to try to disect this software in order to &#8216;see the magic&#8217; but why bother? All you really need to know is that you can download it (if the link hasn&#8217;t been taken down yet) and then push a button and watch the magic. Try it out -&gt; <a href="http://adf.ly/1TyCy" rel="nofollow">http://adf.ly/1TyCy</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rasson</title>
		<link>http://www.hackyeah.com/2010/08/powershell-pc-info-script-wmi/#comment-425</link>
		<dc:creator>Rasson</dc:creator>
		<pubDate>Wed, 12 Jan 2011 19:49:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackyeah.com/?p=122#comment-425</guid>
		<description>Hi there im a noob when it comes to scripting and i like this code but not sure how to set it up. What would be the best way to use this ?</description>
		<content:encoded><![CDATA[<p>Hi there im a noob when it comes to scripting and i like this code but not sure how to set it up. What would be the best way to use this ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://www.hackyeah.com/2010/08/powershell-pc-info-script-wmi/#comment-63</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Thu, 07 Oct 2010 17:47:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackyeah.com/?p=122#comment-63</guid>
		<description>I&#039;m an idiot, so forgive me.  This is what I&#039;m looking for at work but I&#039;m not a code writer at all.  Could you please tell me how I use this and what type of script this is?

Thank you.</description>
		<content:encoded><![CDATA[<p>I&#8217;m an idiot, so forgive me.  This is what I&#8217;m looking for at work but I&#8217;m not a code writer at all.  Could you please tell me how I use this and what type of script this is?</p>
<p>Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.hackyeah.com/2010/08/powershell-pc-info-script-wmi/#comment-61</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Tue, 21 Sep 2010 19:26:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackyeah.com/?p=122#comment-61</guid>
		<description>Thanks Trenton. I was hoping there might be a way of combining the Get-WMIObject class win32_DesktopMonitor with what you&#039;re pulling from the registry.</description>
		<content:encoded><![CDATA[<p>Thanks Trenton. I was hoping there might be a way of combining the Get-WMIObject class win32_DesktopMonitor with what you&#8217;re pulling from the registry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trenton</title>
		<link>http://www.hackyeah.com/2010/08/powershell-pc-info-script-wmi/#comment-60</link>
		<dc:creator>Trenton</dc:creator>
		<pubDate>Tue, 21 Sep 2010 18:07:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackyeah.com/?p=122#comment-60</guid>
		<description>@Mike - I have found no easy way to keep track of the current monitors.  For desktops that are running windows Vista/7 I believe that there is now a WMI object you can query to get monitor serial numbers.  For XP however, the only place I have been able to get this information is in the registry.  It is possible to sort the registry data by date - and then just assume the current monitor is the most recent one.  Although, this is not always the case.  

Check out http://www.nirsoft.net/utils/monitor_info_view.html .  This tool pulls a lot of monitor information from a PC.  It is just an extended version of my powershell script (as an exe), but it is dedicated just to monitors.</description>
		<content:encoded><![CDATA[<p>@Mike &#8211; I have found no easy way to keep track of the current monitors.  For desktops that are running windows Vista/7 I believe that there is now a WMI object you can query to get monitor serial numbers.  For XP however, the only place I have been able to get this information is in the registry.  It is possible to sort the registry data by date &#8211; and then just assume the current monitor is the most recent one.  Although, this is not always the case.  </p>
<p>Check out <a href="http://www.nirsoft.net/utils/monitor_info_view.html" rel="nofollow">http://www.nirsoft.net/utils/monitor_info_view.html</a> .  This tool pulls a lot of monitor information from a PC.  It is just an extended version of my powershell script (as an exe), but it is dedicated just to monitors.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.hackyeah.com/2010/08/powershell-pc-info-script-wmi/#comment-59</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Tue, 21 Sep 2010 17:01:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackyeah.com/?p=122#comment-59</guid>
		<description>Excellent script. 

One question. Is there a way to get just the serial numbers of the installed monitor(s)? Some of our systems have had 3 or 4 monitors over their lifetime and it would be nice to get just the currently used monitor info. Or if the systems are imaged it contains the monitor from the original base system.</description>
		<content:encoded><![CDATA[<p>Excellent script. </p>
<p>One question. Is there a way to get just the serial numbers of the installed monitor(s)? Some of our systems have had 3 or 4 monitors over their lifetime and it would be nice to get just the currently used monitor info. Or if the systems are imaged it contains the monitor from the original base system.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trenton</title>
		<link>http://www.hackyeah.com/2010/08/powershell-pc-info-script-wmi/#comment-54</link>
		<dc:creator>Trenton</dc:creator>
		<pubDate>Tue, 17 Aug 2010 21:14:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackyeah.com/?p=122#comment-54</guid>
		<description>Chris,

1) This will only show locally installed printers.  If however, the network printer was installed using a tcp/ip port (instead of a network share), it will show up.

2)That is great that you are going to use this for your service desk! Let me know how it works.  To get it to work with username/passwords (in case your techs are not local admins on the pc&#039;s)  You can have it prompt for a password, and then send it with the get-wmiobject.  To do so, you will first need to prompt for a username and password.  I think the best way to do this is to change the main area to something like:

$compname = $args[0]
$cred = Get-Credential
if($compname){CheckHost}
else{GetCompName}

And then for each get-wmiobject (gwmi) user the -credential flag.  So for the serialnumber it would look like:

gwmi -computer $compname Win32_BIOS -Credential $cred &#124; Select-Object SerialNumber &#124; Format-List 

Hope that helps....let me know how it goes. 

(P.S.  - The monitor serial number uses the registry instead of wmi, and that may take some more tweaking to get it to work with authentication)</description>
		<content:encoded><![CDATA[<p>Chris,</p>
<p>1) This will only show locally installed printers.  If however, the network printer was installed using a tcp/ip port (instead of a network share), it will show up.</p>
<p>2)That is great that you are going to use this for your service desk! Let me know how it works.  To get it to work with username/passwords (in case your techs are not local admins on the pc&#8217;s)  You can have it prompt for a password, and then send it with the get-wmiobject.  To do so, you will first need to prompt for a username and password.  I think the best way to do this is to change the main area to something like:</p>
<p>$compname = $args[0]<br />
$cred = Get-Credential<br />
if($compname){CheckHost}<br />
else{GetCompName}</p>
<p>And then for each get-wmiobject (gwmi) user the -credential flag.  So for the serialnumber it would look like:</p>
<p>gwmi -computer $compname Win32_BIOS -Credential $cred | Select-Object SerialNumber | Format-List </p>
<p>Hope that helps&#8230;.let me know how it goes. </p>
<p>(P.S.  &#8211; The monitor serial number uses the registry instead of wmi, and that may take some more tweaking to get it to work with authentication)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.hackyeah.com/2010/08/powershell-pc-info-script-wmi/#comment-53</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Tue, 17 Aug 2010 13:25:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackyeah.com/?p=122#comment-53</guid>
		<description>Hi there great script.

I have two queries:

1) When i run the printer info it doesnt show me the networked printer on the users machine.

2) I wish to use this for our service desk users so that they can remote to peoples machines...How do i alter it so hat it asks for a username and password? Also would like the password not to be shown.

Many thanks</description>
		<content:encoded><![CDATA[<p>Hi there great script.</p>
<p>I have two queries:</p>
<p>1) When i run the printer info it doesnt show me the networked printer on the users machine.</p>
<p>2) I wish to use this for our service desk users so that they can remote to peoples machines&#8230;How do i alter it so hat it asks for a username and password? Also would like the password not to be shown.</p>
<p>Many thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

