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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bill BachPresident and Btrieve GuruCommented:
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.
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

OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

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"
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

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
cdarney1Author Commented:
Thanks for everyone's help. - Carol
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.