Solved

monitor information in powershell - windows 7

Posted on 2014-04-25
2
3,677 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
ID: 40023912
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
ID: 40027148
thanks!
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

773 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