Announcement

Collapse
No announcement yet.

Remove Static Context Menu from AD Users and Computers

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Remove Static Context Menu from AD Users and Computers

    I added a custom menu item to the Users > All Tasks using a vbscript.

    I used the 'Add an "unlock user account" option to the Active Directory Users and Computers context menu' article and an example from MSDN as a guide for writing the script.

    What I want to do now is remove the custom menu item but I have no idea how to do this.

    Any ideas are much appreciated.

    Thanks

  • #2
    Re: Remove Static Context Menu from AD Users and Computers

    Just edit the adminContextMenu attribute of the CN=user-Display,CN=409,CN=DisplaySpecifiers,CN=Configurati on,DC=domain,DC=com object and remove the line referencing the script you added. That (after replication between the DCs and restarting the ADU&C) should do the trick
    Guy Teverovsky
    "Smith & Wesson - the original point and click interface"

    Comment


    • #3
      Re: Remove Static Context Menu from AD Users and Computers

      Thanks Guy. That did the trick.

      Do you know if there is anyway to do that with a script?

      thanks again.

      Comment


      • #4
        Re: Remove Static Context Menu from AD Users and Computers

        I have a piece of code that I once wrote to install a script as display specifier. Feel free to customize it - it has all the relevant part needed for deleting an entry in the context menu:

        Code:
        Function installAsDisplaySpecifier(sConfigContainer, sFileSystemPath)
        	Dim oOUDisplaySpecifier, sCopiedScriptPath
        	
        	installAsDisplaySpecifier = False
        
        	While sFileSystemPath =""  
        		sFileSystemPath = InputBox("Directory to install the script to (ex. C:\Temp):", "Installation path (ex. C:\Temp):", "C:\Temp")
        		Dim oFSO, sFileName
        		Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
        		If oFSO.FolderExists(sFileSystemPath) Then 
        			If Right(sFileSystemPath,1)<>"\" Then sFileSystemPath=sFileSystemPath & "\"
        		Else
        			sFileSystemPath=""
        		End If
        	Wend
        	sCopiedScriptPath = fCopyItself(sFileSystemPath) 
        	If sCopiedScriptPath<>"FAILED" Then
        		Set oOUDisplaySpecifier = GetObject("LDAP://CN=organizationalUnit-Display,CN=409,CN=DisplaySpecifiers," & sConfigContainer)
        		
        		Dim arrEntry, maxIndex, sContextMenuEntry, val
        		For Each val in oOUDisplaySpecifier.GetEx("contextMenu")
        			arrEntry = Split(val,",")
        
        			'Prevent duplicates
        			If arrEntry(1) = "Redirect users mailboxes to new MDB" Then 
        				oOUDisplaySpecifier.PutEx ADS_PROPERTY_DELETE, "contextMenu", Array(val) 
        				oOUDisplaySpecifier.SetInfo
        			End If
        
        			If maxIndex < arrEntry(0) Then maxIndex=arrEntry(0)
        		Next
        		maxIndex=maxIndex+1
        		sContextMenuEntry = maxIndex & ",Redirect users mailboxes to new MDB," & sCopiedScriptPath
        
        		oOUDisplaySpecifier.PutEx ADS_PROPERY_APPEND, "contextMenu", Array(sContextMenuEntry)
        		oOUDisplaySpecifier.SetInfo
        		installAsDisplaySpecifier = true
        	Else
        		installAsDisplaySpecifier = false
        		bail "Failed to copy the script to " & sFileSystemPath
        	End If
        End Function
        Guy Teverovsky
        "Smith & Wesson - the original point and click interface"

        Comment

        Working...
        X