How can I delete a valuename under a rootkey using command file

I'm trying to delete the DefaultProfile name in the registry under Windows Messaging Subsystem\Profiles.  I want to delete the DefaultProfile created for Novell Groupwise without deleting any other profile names.  I'm not a vbscripter so I'm trying to do this with a batch file.  I keep getting the following error: "The sytems was unable to find the specified rergistry key or value".  Here's my code.  reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\DefaultProfile=Novell GroupWise"


reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\DefaultProfile=Novell GroupWise"

Open in new window

cdarney1Asked:
Who is Participating?
 
sirbountyCommented:
If the key is string and the name is DefaultProfile, then use the first,
Otherwise if it's indeed the Default value, then use the second
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles" /v DefaultProfile
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles" /ve

Open in new window

0
 
Bill BachPresidentCommented:
REG DELETE is documented like this:

REG DELETE KeyName [/v ValueName | /ve | /va] [/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.

  ValueName  The value name, under the selected Key, to delete.
             When omitted, all subkeys and values under the Key are deleted.

  /ve        delete the value of empty value name (Default).

  /va        delete all values under this key.

  /f         Forces the deletion without prompt.

Examples:

  REG DELETE HKLM\Software\MyCo\MyApp\Timeout
    Deletes the registry key Timeout and its all subkeys and values

  REG DELETE \\ZODIAC\HKLM\Software\MyCo /v MTU
    Deletes the registry value MTU under MyCo on ZODIAC


As such, your proper command is likely going to be:

reg delete "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles" /v DefaultProfile

When it works, add the /f option to skip the prompt.
0
 
cdarney1Author Commented:
Great the first option worked when I run the script manually.  (reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles" /v DefaultProfile)

Now to complicate matters I need to push this script out using SMS and it doesn't like the registry deletions.  It is reporting back that it can't locate the specified values.  Does anyone know how the reg key deletion needs to be written to successfully deploy with SMS?  Thanks -- Carol

0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
sirbountyCommented:
I don't use SMS (much), so my unexperienced stab at this would be the quotes.
If you have to include the entire command string in quotes, you probably need to include additional quote marks, i.e

"reg delete ""HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging\SubSystem\Profiles"" /v DefaultProfile"
0
 
AmazingTechCommented:
SMS works on computers not users. The HKEY_CURRENT_USER is not the user that is logged into the machine when SMS runs it's deployment. I think it is probably the SYSTEM account. You should run your script via AD Logon Script or GPO User Logon Script.

Here's some lines to check for Novell Groupwise default profile and delete only if it is.

To clean out the profile add this line:

reg delete "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Novell GroupWise" /f

reg query "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles" /v DefaultProfile | FIND /i "Novell GroupWise"
IF NOT ERRORLEVEL 1 (
    reg delete "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles" /v DefaultProfile /f
)

Open in new window

0
 
cdarney1Author Commented:
Thanks for all the input.  What I learned is that SMS doesn't touch the HKCU so we had to create a vb script to delete the registry entries.  We will have to clean up the vbs script we are running in startup, but that isn't a hard task.  Thanks again for all the help.  -- Carol
0
 
cdarney1Author Commented:
Thanks for everyone's help. - Carol
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.