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

Registry and data types

Closed Thread
 
Thread Tools Display Modes
Old 01-02-2008   #1 (permalink)
Marco Shaw [MVP]
Guest


 

Registry and data types

Can I only create REG_SZ data types from PowerShell while using the
registry provider?

I can't seem to determine whether one can create a REG_MULTI_SZ data
type, for example.

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
Old 01-02-2008   #2 (permalink)
Shay Levi
Guest


 

Re: Registry and data types

It depeneds on the -value value you supply:

# creates REG_SZ
New-ItemProperty -Name StringValue -Value 1 -Path HKCU:\Software

# creates REG_MULTI_SZ
New-ItemProperty -Name MultipleStringValue -Value ([string[]]("Power","Shell"))
-Path HKCU:\Software

# creates REG_BINARY
New-ItemProperty -Name BinaryValue -Value ([byte[]](1,2,3,4)) -Path HKCU:\Software


Check this:
http://scriptolog.blogspot.com/2007/...s-library.html


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic


Quote:

> Can I only create REG_SZ data types from PowerShell while using the
> registry provider?
>
> I can't seem to determine whether one can create a REG_MULTI_SZ data
> type, for example.
>
> Marco
>
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
> Blog:
> http://marcoshaw.blogspot.com

Old 01-02-2008   #3 (permalink)
Jeffery Hicks [MVP]
Guest


 

Re: Registry and data types

I knew I had this information somewhere:

PS C:\> $reg.SetMultiStringValue($HKCU,"PowerShellTFM\Key1\Key2",`
Quote:
Quote:

>> "Sample Multi",(get-content c:\file.txt))
I revised the registry chapter for the 2nd edition of Windows PowerShell:
TFM to include a lot more on the StdReg WMI provider.

--
Jeffery Hicks
Microsoft PowerShell MVP
http://www.scriptinganswers.com
http://www.powershellcommunity.org

Now Available: WSH and VBScript Core: TFM
Coming Soon: Windows PowerShell: TFM 2nd Ed.

"Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote in message
news:O921xLUTIHA.5400@xxxxxx
Quote:

> Can I only create REG_SZ data types from PowerShell while using the
> registry provider?
>
> I can't seem to determine whether one can create a REG_MULTI_SZ data type,
> for example.
>
> Marco
>
> --
> Microsoft MVP - Windows PowerShell
> http://www.microsoft.com/mvp
>
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
>
> Blog:
> http://marcoshaw.blogspot.com
Old 01-02-2008   #4 (permalink)
Marco Shaw [MVP]
Guest


 

Re: Registry and data types

Thanks Shay!

I had noticed that post, but didn't dig into it. Great post by the way
for others.

Marco
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add to DevicePath Data in registry chris .NET General 0 04-09-2008 12:24 PM
could not update registry data? =?Utf-8?B?SG93IGNhbiBJIGluc3RhbGwgdmlzdGE/?= Vista General 3 09-09-2006 02:14 PM
could not update registry data? =?Utf-8?B?SG93IGNhbiBJIGluc3RhbGwgdmlzdGE/?= Vista General 0 09-09-2006 12:47 PM
could not update registry data? =?Utf-8?B?SG93IGNhbiBJIGluc3RhbGwgdmlzdGE/?= Vista General 0 09-09-2006 12:47 PM








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