The following commands work on my PC:
reg add Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa /v everyoneincludesanonymous /t REG_DWORD /d 1 /f
reg add Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters /v restrictnullsessaccess /t REG_DWORD /d 0However, on some machines it responds with:
ERROR: Invalid key name.
Type "REG ADD /?" for usage.I'm unsure as to what is different and how I could handle this.
31 Answer
According to the help for REG.EXE ADD /? the format of the registry path must start with either a computer name or one of five root key names:
REG ADD KeyName [/v ValueName | /ve] [/t Type] [/s Separator] [/d Data] [/f] KeyName [\\Machine\]FullKey Machine Name of remote machine - omitting defaults to the current machine. Only HKLM and HKU are available on remote machines. FullKey ROOTKEY\SubKey ROOTKEY [ HKLM | HKCU | HKCR | HKU | HKCC ] SubKey The full name of a registry key under the selected ROOTKEY.If your KeyName value begins with \\ it will be treated as a computer name, otherwise REG.EXE expects one of the ROOTKEY values. Since your command does not begin the path with \\ REG.EXE expects one of the ROOTKEY values. Because Computer is not one of those five values, you get the error:
ERROR: Invalid key name.
Type "REG QUERY /?" for usage.
You can fix your command by either removing the leading Computer\ from the path:
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa /v everyoneincludesanonymous /t REG_DWORD /d 1 /fOr by specifying the computer name using the leading slashes:
reg add \\Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa /v everyoneincludesanonymous /t REG_DWORD /d 1 /fNote: This assumes your computer name is actually "Computer". If it isn't provide its actual name.
1