View Single Post
Old 09-04-2007   #10 (permalink)
Jon


 
 

Re: BUG? Registry keys with / in names


"Roman Kuzmin" <z@xxxxxx> wrote in message
news:egCupvt7HHA.980@xxxxxx
Quote:

> It looks like Registry provider or Get-ChildItem (or both, or something
> else in the engine) has troubles with registry key names containing / in
> them (it is a valid symbol for registry names). Get-ChildItem does not
> return items with such names. Can anybody confirm this?
>
> --
> Thanks,
> Roman Kuzmin
> PowerShellFar and FarNET: http://code.google.com/p/farnet/
>
>

A few thoughts on how you might be able to get round the bug for the
moment.....

#Write a key containing / to the registry
$WshShell = no -com wscript.shell
$WshShell.RegWrite('HKCU\DeleteMe/Later\',"","REG_SZ")

#Enumerate subkeys
$strcomputer = ''
[Reflection.Assembly]::LoadWithPartialName("microsoft.win32")
$reghive = [Microsoft.Win32.RegistryHive]
$regkey =
[microsoft.win32.registrykey]:penremotebasekey($reghive::CurrentUser,$strcomputer)
$regkey.GetSubKeyNames()

#Remove the key
$WshShell.RegDelete('HKCU\DeleteMe/Later\')
$regkey.GetSubKeyNames()

--
Jon


My System SpecsSystem Spec