Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Re: select instance in WMI query

Closed Thread
 
Thread Tools Display Modes
Old 09-05-2007   #1 (permalink)
Nik
Guest


 

Re: select instance in WMI query


"Nik" <na@xxxxxx> schrieb im Newsbeitrag news:...
Quote:

> Hi Justin,
>
> Just started PS, but managed to find out that one for one PC:
>
> write-host
> write-host "BIOS Information . . ." -foregroundcolor "green"
> $colItems = get-wmiobject -class "Win32_Bios" -namespace "root\CIMV2" `
>
> foreach ($objItem in $colItems) {
> # write to screen
> write-host "Serial Number: " $objItem.SerialNumber
> write-host
> }
>
> #$strOutputString | out-file "c:\PSAD\result-serial.txt" (if you need a
> text version)
>
> In case you want to query a list of PC;s you can use that one:
>
> write-host "Serial Information . . ." -foregroundcolor "magenta"
> $Liste = [System.IO.File]::OpenText("c:\PSAD\Liste.txt")
> while($Machine = $Liste.ReadLine())
>
> {$colItems = get-wmiobject -computername $Machine -class
> "Win32_Bios" -namespace "root\CIMV2" `
>
> foreach ($objItem in $colItems) {
> # write to screen
> write-host "Serial Number: " $objItem.SerialNumber
> write-host
> }
> }
> $Liste.Close()
>
> And i am sure you can even query against Active Directory, but did not
> find out how it could look like yet. Maybe any one has s cript for such a
> query. I would appreciate that.
>
> Brgds Nik
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> "Justin Rich" <jrich523@xxxxxx> schrieb im Newsbeitrag
> news:eZDfetj6HHA.2752@xxxxxx
Quote:

>> im trying to build a WMI query that gets the service tag. im trying to do
>> it with one WMI query but i dont know how to select an instance with a
>> query.
>>
>> when you query win32_systemenclosure you get a collection back, which
>> only contains one instance (always named "system enclosure")
>>
>> so i want to do something like....
>>
>> select serialnumber from win32_systemenclosure where instance = "system
>> enclosure"
>>
>> id like it to return a string, rather than a collection.
>>
>> Thanks
>>
>> Justin
>>
>
>

Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Files - Disable or Enable Full Row Select Brink Tutorials 6 07-19-2008 08:08 AM
64-bit vs 32-bit PowerShell instance Chris Kuntz PowerShell 2 09-20-2007 02:42 AM
select instance in WMI query Justin Rich PowerShell 18 09-06-2007 07:39 AM
set-user -instance GodOfLions PowerShell 4 07-27-2007 11:02 AM
Multiple File Select and Select All =?Utf-8?B?Sm9obg==?= Vista file management 4 03-16-2007 11:11 AM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50