Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. System Admin
  4. Scripting MMC with vbscript.

Scripting MMC with vbscript.

Scheduled Pinned Locked Moved System Admin
databaselinuxdebuggingtoolshelp
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dan Kamp
    wrote on last edited by
    #1

    Hi, I am a bit out of my depth here so I have some questions. At my site we do unattended installs and configuration of our machines. I would like to script the install of a mmc snap in but have come to an impasse. I have found some sample code but I cannot find documentation to take me further. I would like to add the Group Policy Object Editor which I can do. But I want to further configure it to the local policy/Non-administrators which is where I get suck. Below is what I have so far any and all help will be welcome. Thanks in advance. d

    'Start of UAC workaround code

    If WScript.Arguments.length =0 Then
    Set objShell = CreateObject("Shell.Application")

    objShell.ShellExecute "wscript.exe", Chr(34) & _
    WScript.ScriptFullName & Chr(34) & " uac", "", "runas", 1
    Else

    'start code here

    '################################################
    ' VARIABLE DECLARATIONS
    '################################################
    'Option Explicit
    Dim objSCANode
    Dim objMMC

    '################################################
    ' EXECUTE 'Open Database...' MENU ITEM
    '################################################
    Set objMMC = CreateObject("MMC20.Application")

    objMMC.Document.SnapIns.Add("Group Policy Object Editor")
    objMMC.Show
    Set objSCANode = objMMC.Document.ScopeNamespace.GetChild(objMMC.Document.RootNode)
    objMMC.Document.ActiveView.Select objSCANode
    objMMC.Document.ActiveView.SelectionContextMenu.Item(2).Execute

    '################################################
    ' DEBUG LINES
    '################################################
    wscript.Echo "objMMC.Document.RootNode.Name: " + objMMC.Document.RootNode.Name
    wscript.Echo "objMMC.Document.ScopeNamespace.GetChild(objMMC.Document.RootNode): " + objSCANode.Name ' "Group Policy Object Editor"
    wscript.Echo "objMMC.Document.ActiveView.Memento (objSCANode.Name): " + objMMC.Document.ActiveView.Memento
    wscript.Echo "objMMC.Document.ActiveView.Selection.Item(1): " + objMMC.Document.ActiveView.Selection.Item(1).Name
    wscript.Echo "objMMC.Document.ActiveView.SelectionContextMenu.Item(2).DisplayName: " + objMMC.Document.ActiveView.SelectionContextMenu.Item(2).DisplayName
    wscript.Echo "objMMC.Document.ActiveView.SelectionContextMenu.Item(2).Path: " + objMMC.Document.ActiveView.SelectionContextMenu.Item(2).Path

    'end of code here

    end if
    'end or UAC code

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups