Remove the new shortcut item from the context menu

I want to be able to remove the new shortcut item from the Windows Explorer context menu from my users.  I still want them to be able to send items in their my documents folder to the desktop as a shortcut and don't want to completely remove the context menu.  Can't figure out where that key is in the registry and don't see that option as part of the options of a group policy object (where I'd prefer to set the option).  Help!
LVL 4
WerewolfTAAsked:
Who is Participating?
 
oBdAConnect With a Mentor Commented:
The easiest way to achieve this is to redirect the command that is executed when the "New Shortcut" menu is chosen.
The original location is HKLM\Software\Classes\.lnk\ShellNew, a REG_SZ value named "Command".
I guess you want to exclude administrators and maybe some other people from this; in that case, creating the value under HKCU\... will work as well.
You should be able to set this using group policies with a custom adm template.
This will not be a proper group policy, though, it will be a "preferred setting" or "branding", as this will write to the registry outside of the "policies" keys; so if you want to remove the setting, deleting the GPO or setting it to "not configured" will *NOT* work, it needs to be explicitely undone.
If you just want nothing (much) to happen, use "%Comspec% /c del "%1" for the command; that will immediately delete the new shortcut, instead of calling the wizard.
If you want to inform the users that they are behaving badly (and assuming that you have wscript on your clients), you can inform them that the action has been restricted by redirecting the command to the (not very sophisticated) vbscript below; either deploy it to your clients, or, if your network is stable enough (and there are no laptops with cached credentials logon involved), run it from, for example, the netlogon share.
As usual: No warranties included, use it at your own risk, test it before you apply it in earnest.

====8<----[ShellNew.adm]----
CLASS USER

CATEGORY !!AdditionalSettings
  CATEGORY !!Explorer
    POLICY !!ShellNew
      KEYNAME "Software\Classes\.lnk\ShellNew"
      PART !!Command TEXT END PART
      PART " " COMBOBOX REQUIRED
        VALUENAME "Command"
        SUGGESTIONS
          !!NewLinkDeleteOnly
          !!NewLinkScript
        END SUGGESTIONS
        DEFAULT !!NewLinkDeleteOnly
      END PART
    END POLICY ; ShellNew
  END CATEGORY ; Explorer
END CATEGORY

[strings]
AdditionalSettings=Additional settings
Explorer=Windows Explorer
ShellNew=Disable 'New Shortcut' in context menu
Command=Command:
NewLinkDeleteOnly=%Comspec% /c del "%1"
NewLinkScript=wscript "\\%Logonserver%\netlogon\ShellNew.vbs" "%1"
====8<----[ShellNew.adm]----

====8<----[ShellNew.vbs]----
msgbox "This function has been disabled by the administrator!", vbOKOnly + vbExclamation, "Restricted function!"
set fs = CreateObject("Scripting.FileSystemObject")
fs.DeleteFile(Wscript.Arguments(0))
====8<----[ShellNew.vbs]----
0
 
Gareth GudgerCommented:
What item are you trying to remove?
0
 
WerewolfTAAuthor Commented:
The item that lets them create a new blank shortcut (r. click -> new -> shortcut) on the desktop.
0
Protect Your Employees from Wi-Fi Threats

As Wi-Fi growth and popularity continues to climb, not everyone understands the risks that come with connecting to public Wi-Fi or even offering Wi-Fi to employees, visitors and guests. Download the resource kit to make sure your safe wherever business takes you!

 
JohnK813Commented:
c:\documents and settings\[username]\SendTo holds all of those context menu items - just delete "Send to Desktop".  I don't know if there's an easier way to remove other than going through each user's folder individually - maybe a quick batch file would do the trick.

Also, I'm assuming that making the change for "Default User" would put the change into effect for all new users you create.
0
 
oBdACommented:
The easiest way would be to integrate that into the logon script. Assuming that you don't want this to apply to all users, you might want to use ifmember.exe (a free W2k Resource Kit tool) to check if the user is member of a certain group ("GRemoveSendTo" in the example) and then delete the link only when the user is a member.

====8<----[logon.cmd]----
@echo off
:: *** Check if the user is member of the group that has the Desktop-SendTo deleted;
:: *** note that ifmember returns errorlevel 1 if the user *is* member!
ifmember.exe GRemoveSendTo
if not errorlevel 1 goto DeleteEnd
if exist "%UserProfile%\SendTo\*.desklink" del "%UserProfile%\SendTo\*.desklink"
:DeleteEnd
====8<----[logon.cmd]----

Resource Kits Free Tool Downloads: Ifmember.exe
http://www.microsoft.com/windows2000/techinfo/reskit/tools/new/ifmember-o.asp
0
 
WerewolfTAAuthor Commented:
Thanks for the feedback.  However, I guess that I wasn't being clear.  I'm not looking to modify the list of places a shortcut can be sent to.  What I'm looking at is when you right click a blank area of your desktop or a blank area in your my documents folder, there's a "new" item in that context menu that pulls out a submenu with folder, shortcut, briefcase, etc., etc. in it.   It's that 2nd item in the submenu, "shortcut", that I'm trying to do away with.
0
 
Gareth GudgerCommented:
Haven't found anything yet....still searching... :)
0
 
mdiglioCommented:
Hello,
You can try this method using the registry
navigate to HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\New
and then blank out the default string value of {D969A300-E7FF-11d0-A93B-00A0C90F2719}

Before setting the default string to be blank you should export the New key for a backup.

Doing this should not affect right click a file and saying 'send to'

0
 
WerewolfTAAuthor Commented:
Thanks, guys.  Monday's are usually hectic around here, so give me a couple of days to try out your suggestions on a test machine and see what works out best.
0
 
Gareth GudgerCommented:
Yea I was looking at the "HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\New" key myself... seemed right but wasn't sure which part to delete....
0
 
WerewolfTAAuthor Commented:
oBdA,
  I couldn't get your adm file to work (bummer, and I've never written a custom adm file so I have no idea what went wrong.  It created the Additional Settings\Windows Explorer folder but with nothing inside), but you pointed me in the right direction, got me enough info to come up with a working solution, and gave me a new idea (with the vbs script).  Thanks for the help.
0
 
oBdACommented:
Maybe I should have mentioned that more specifically: Since this is not a policy (as I actually mentioned), the policy editor MMC will not display it in the default setting. Highlight the "Administrative Templates" tree, then from the "View" menu uncheck the "Show policies only" (or similar); the editor will now show the "branding" settings in red (while the real policies are in blue).
0
 
WerewolfTAAuthor Commented:
Yes, you did say that about it not being an actual policy.  I didn't know about that filter.  Changing that made the settings show up under my gpo, and I suspect that little bit of information will prove useful in the future. Thanks.  Also, just to pass along to anyone who might be reading this in the future, I was able to combine both of the commands you provided above as NewLinkDeleteOnly and NewLinkScript into one as follows:  
%Comspec% /c del "%1" && wscript "\\%Logonserver%\netlogon\ShellNew.vbs"

I just asked a similar question here, wanted to give you first crack at it:
http://www.experts-exchange.com/Security/Win_Security/Q_20946629.html
0
 
oBdACommented:
No need to combine the two: The script will delete the short cut as well: fs.DeleteFile(Wscript.Arguments(0))
The difference is just that the "comspec" version doesn't require the script deployment; you only need one of the solutions, not both.
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.