Solved

monitor information in powershell - windows 7

Posted on 2014-04-25
2
3,838 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 40

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

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…
A brief introduction to what I consider to be the best editor for PowerShell.
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

685 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