Skip to content

Instantly share code, notes, and snippets.



Created Feb 18, 2015
What would you like to do?
Option Explicit
Dim TheRoot, TheDisplay, TheContext, TheMenu, TheLoop, TheNewMenu
set TheRoot = Getobject(LDAP://RootDSE)
set TheContext = GetObject("LDAP://" & "CN=409, CN=DisplaySpecifiers," & TheRoot.get("configurationNamingContext"))
Set TheDisplay = TheContext.GetObject("displaySpecifier","cn=user-Display")
TheLoop = 0
If Not IsEmpty(TheDisplay.adminContextMenu) Then TheMenu = TheDisplay.GetEx("adminContextMenu")
For TheLoop = LBound(TheMenu) to UBound(TheMenu)
If InStr(TheMenu(TheLoop),"&Default Printer") Then
MsgBox "Menu already exists ... exiting ..."
End If
Next TheLoop = TheLoop + 1
End If
TheNewMenu = CStr(TheLoop) & ",&Default Printer...,defaultPrinterAdmin.vbs"
TheDisplay.PutEx 3,"adminContextMenu" , Array(TheNewMenu)
Set TheDisplay = Nothing
Set TheContext = Nothing
Set TheRoot = Nothing
MsgBox "Added Admin Context Menu item"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.