"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
>>
| | | | | >
> | |
| | |