haakonlu
haakonlu

Reputation: 949

Powershell: Win32_BIOS Serialnumber validity

In a system i'm making I am saving files from each computer to a directory which has the name of the serialnumber i collect from this code:

$serialnr = gwmi -computer $compname Win32_BIOS | ForEach {$_.SerialNumber}

When I run this code on my computer I get the serialnumber, however when the same code is run on a friends computer the output reads: "FFFFFFF" (I am not sure about the number of F's).

What I'm hoping is that "FFFFFFF" is like a standard output if I cannot get the true serialnumber, then I could atleast use that as a parameter for another command to make "fix".

Q: Anybody has some information about the possible outputs from this command, or possible fixes?

All ideas and all help will be greatly appreciated!

Upvotes: 0

Views: 1658

Answers (1)

David Brabant
David Brabant

Reputation: 43509

I don't understand the purpose of your ForEach. Am I missing something?

$serialnr = gwmi win32_bios | select -Expand serialnumber | out-string

will give you the serial number.

Upvotes: 1

Related Questions