Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Registry and data types

Reply
 
Old 01-02-2008   #1 (permalink)
Marco Shaw [MVP]


 
 

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

My System SpecsSystem Spec
Old 01-02-2008   #2 (permalink)
Shay Levi


 
 

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

My System SpecsSystem Spec
Old 01-02-2008   #3 (permalink)
Jeffery Hicks [MVP]


 
 

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
My System SpecsSystem Spec
Old 01-02-2008   #4 (permalink)
Marco Shaw [MVP]


 
 

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
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Problems with data types PowerShell
could not update registry data? Vista General
could not update registry data? Vista General
could not update registry data? Vista General


Vista Forums 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 Ltd

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