This is an actual registry path and the back tick does not seem to work.
set-location
"HKLM:\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\DES
56`/56"
I found some documentation that talks about WSH not supporting the use
of the slash in a registry key, but WMI does.
Does anyone know if this is also true for powershell?
Thanks for any help.
Dave M.
Escaping the forward slash / with the PS back tick will never change
anything, since from a string syntax perspective / is not a special character
that may behave differently when quoted.
Unfortunately it looks like PS does not support / in a registry key name at
all, even though / is an absolutely acceptable key name character for the
Win32 registry API. I assume this is because PS in general treats both,
forward slash and backslash, as acceptable element separator chars for any
kind of path and therefore / never can be part of any path element name.
Get-ChildItem does not even retrieve existing keys which contain a / in their
name.
I rate this as a serious flaw of the PS registry provider, but have no
workaround suggestion other than to use alternate command line registry tools.
--
Gerd
but this might be a bit less silly as I did think :
http://thepowershellguy.com/blogs/posh/archive/2008/07/28/just-silly.aspx
this might work for editing it, do not know a workaround to create, but
might be possible using .NET directly, also :
PS HKLM:\> cd hklm:;(get-psdrive hklm).CurrentLocation =
'HKLM:\System\CurrentControlSet\Control\SecurityProvi
ders\SCHANNEL\Ciphers\DES\56`/56'
PS
HKLM:\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\DES\56`/56> ls
h.t.h.
/\/\o\/\/
http://thePowerShellGuy.com
It also looked like a flaw in the registry provider to me.
I believe I have a workaround using [Microsoft.Win32.RegistryHive]
Thanks again
$KeyPath =
'HKLM:\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\DES
56/56'
$RegType = [Microsoft.Win32.RegistryHive]::LocalMachine
$regKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($RegType,
$Env:Computername)
$regKey = $regKey.OpenSubKey($KeyPath, $TRUE)
if( -not $regKey.GetValue("Enabled")){
$regKey.SetValue("Enabled", 0, [Microsoft.Win32.RegistryValueKind]::DWord)
}
else
{
$regKey.SetValue("Enabled", 0, [Microsoft.Win32.RegistryValueKind]::DWord)
}
Thanks,
Dave M