Scripting MMC

5 pts.
Tags:
Active Directory
Group Policy
Group Policy management console
MMC
VBScript
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.
'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
 

Software/Hardware used:
Windows 7
ASKED: December 17, 2013  4:45 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following