Solved

monitor information in powershell - windows 7

Posted on 2014-04-25
2
3,452 Views
Last Modified: 2016-11-23
how can i get the monitor information to look something like this on the output?
model: Dell e980
serial number: 533434344
Size: 16


what i currently use is this:
gwmi -computer $compname -Credential $creds WmiMonitorID -Namespace root\wmi | ForEach-Object {Write-Host "Model" (  $_.UserFriendlyName -notmatch 0 | foreach {[char]$_}) -join ""; (  $_.ProductCodeID -notmatch 0 | foreach {[char]$_}) -join ""; ( Write-Host "Monitor Size:"  $_.UserFriendlyNameLength -notmatch 0 | foreach {[char]$_}) -join "";}

Open in new window


and i end up getting these results
results
0
Comment
Question by:bbimis
2 Comments
 
LVL 39

Accepted Solution

by:
footech earned 500 total points
Comment Utility
I think you want something like this.
gwmi WmiMonitorID -Namespace root\wmi |
 Select @{n="Model";e={[System.Text.Encoding]::ASCII.GetString($_.UserFriendlyName -ne 00)}},
  @{n="Serial Number";e={[System.Text.Encoding]::ASCII.GetString($_.SerialNumberID -ne 00)}} |
 Format-List

Open in new window


Pretty sure you want the SerialNumberID property instead of ProductCodeID for the serial number.  I left out the size because I don't know of any property that contains that info.  There are a few methods for converting byte arrays to characters, I just used one that doesn't require the -join operator.
0
 

Author Closing Comment

by:bbimis
Comment Utility
thanks!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.

762 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

8 Experts available now in Live!

Get 1:1 Help Now