Quantcast
Channel: The Old New Thing
Viewing all articles
Browse latest Browse all 3085

How do I get the computer’s serial number? Consuming Windows Runtime classes in desktop apps, part 5: PowerShell

$
0
0

Continuing our series on getting the computer's serial number in desktop apps in various languages, we look at PowerShell.

I warned you that you're going to be underwhelmed, so prepare to be underwhelmed.

# The following line has been broken up for readability purposes.
# Make sure to glue them together into one long line.
# (The continuation character doesn't work here.)
$addType = [Windows.System.Profile.SystemManufacturers.SmbiosInformation,
            Windows.System.Profile.SystemManufacturers,
            ContentType=WindowsRuntime]

[Windows.System.Profile.SystemManufacturers.SmbiosInformation]::SerialNumber

The first thing we do is add the type to PowerShell, which we do by loading up the type from the Windows Runtime metadata. Specify the type, the parent namespace, and say ContentType = WindowsRuntime.

And that's it. We can now obtain the Serial­Number static property from the Smbios­Information class just like any other type.

Next time, we'll wrap things up with a brief discussion of the Smbios­Information class itself.


Viewing all articles
Browse latest Browse all 3085

Trending Articles


Practice Sheet of Right form of verbs for HSC Students


Rajasthan Board 10th Result 2016 Roll No wise & Name Wise


Moondru Mudichu 20-07-2016 – Polimer tv Serial


fs_older_downloads


Calaveras conflict results in shooting, 4 arrests


Guilty Pleasures


Black Angus Grilled Artichokes


Download: Rich Bizzy -Panono Ukwenda (Cover)


Muloraki Au


where in jaunpur randi khana



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>