Create a hashtable from a here-string

This syntax is usefull when I need to create a hashtable from content published on MSDN (or somewhere on the web). Just copy content into clipboard, paste into ISE, surround by here-string syntax @’ ‘@ (remember that Powershell doesn’t like whitespace before the here string closing ‘@) and finally prepend this piece of code $variable = DATA {
ConvertFrom-StringData -StringData

The example below shows how to create a bios characteristics hashtable to decode the information in win32_bios WMI class

$BiosCharacteristics = DATA {
ConvertFrom-StringData -StringData @'
3=BIOS Characteristics Not Supported
4= ISA is supported
5= MCA is supported
6= EISA is supported
7= PCI is supported
8= PC Card (PCMCIA) is supported
9= Plug and Play is supported
10= APM is supported
11= BIOS is Upgradable (Flash)
12= BIOS shadowing is allowed
13= VL-VESA is supported
14= ESCD support is available
15= Boot from CD is supported
16= Selectable Boot is supported
17= BIOS ROM is socketed
18= Boot From PC Card (PCMCIA) is supported
19= EDD (Enhanced Disk Drive) Specification is supported
20= Int 13h - Japanese Floppy for NEC 9800 1.2mb (3.5, 1k Bytes/Sector, 360 RPM) is supported
21= Int 13h - Japanese Floppy for Toshiba 1.2mb (3.5, 360 RPM) is supported
22= Int 13h - 5.25 / 360 KB Floppy Services are supported
23= Int 13h - 5.25 /1.2MB Floppy Services are supported
24= Int 13h - 3.5 / 720 KB Floppy Services are supported
25= Int 13h - 3.5 / 2.88 MB Floppy Services are supported
26= Int 5h, Print Screen Service is supported
27= Int 9h, 8042 Keyboard services are supported
28= Int 14h, Serial Services are supported
29= Int 17h, printer services are supported
30= Int 10h, CGA/Mono Video Services are supported
31= NEC PC-98
32= ACPI is supported
33= USB Legacy is supported
34= AGP is supported
35= I2O boot is supported
36= LS-120 boot is supported
37= ATAPI ZIP Drive boot is supported
38= 1394 boot is supported
39= Smart Battery is supported
'@
}

$BiosCharacteristics

Advertisements

Tagged:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

smsagent

Tips, tricks and time-savers for the Windows and ConfigMgr administrator

To The Point

Anything about Technology and Business

Brian's Power Windows Blog

Microsoft in the Enterprise. Windows, Hyper-V, Exchange, SQL, and more!

PowerScripting Podcast

Shownotes and links for the PowerScripting Podcast, a podcast to help people learn Windows Powershell

Learn Powershell | Achieve More

What is this Powershell of which you speak?

%d bloggers like this: