Import-Module ActiveDirectory
Get-ADComputer -SearchBase 'OU=myou2,OU=myou1,dc=mydomain,dc=local' -Filter '*' | `
Select -Exp Name | %{echo $_ ; Get-WMIObject -Class Win32_BIOS -ComputerName $_| Format-List SerialNumber; `
$monitor = gwmi WmiMonitorID -Namespace root\wmi -computername $_;($monitor.SerialNumberID -notmatch 0 | foreach {[char]$_}) -join ""};
PowerShell neophyte here. I managed to hack this little line together from various scripts I found here and on other forums.
It works fine, but the output is messy. It appears with a lot of unnecessary linebreaks and the SerialNumber label:
COMPUTERNAME SerialNumber : COMPUTERSERIAL MONITORSERIAL
I'd like the output to simply be:
COMPUTERNAME COMPUTERSERIAL MONITORSERIAL
How would I go about this?
Thanks for reading.
- Edited by stuart.macdonald Friday, August 21, 2015 11:10 AM