Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

scripting mmc actions

129 views
Skip to first unread message

Mike Koch

unread,
Apr 21, 2005, 1:44:21 PM4/21/05
to
Hi folks,

Is there a way to script mmc actions? I've written a little hta that takes a
user ID as input, then queries our SMS database, retrieves all of the
computers that user has logged into recently, then creates buttons that
allow me to start a remote control session and/or display that computer's
latest inventory report. I'd like to add another function that starts up an
mmc with the computer management snapin set to the remote computer, so I can
easily look at things like event logs and group memberships for that
computer. So, basically, I want to use vbscript to launch the mmc with the
computer management snapin and pass it the remote computer name in a
variable. Thoughts?

Thanks,
Mike


Unknown

unread,
Apr 21, 2005, 2:20:11 PM4/21/05
to
You could always use VBscript to send keystrokes... not the most eligant solution but it would work...

here is an excample.


set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "mmc"
WScript.Sleep 1000
WshShell.AppActivate "Console1"
WScript.Sleep 1000
WshShell.SendKeys "%f"
WScript.Sleep 50
WshShell.SendKeys "m"
WScript.Sleep 400
WshShell.SendKeys "{TAB}{TAB}{TAB}{ENTER}"
wscript.sleep 400
WshShell.SendKeys "{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{TAB}{enter}"
wscript.sleep 50
WshShell.SendKeys "{TAB}{ENTER}"
wscript.sleep 50
WshShell.SendKeys "{TAB}{ENTER}"
wscript.sleep 50
WshShell.SendKeys "{TAB}{ENTER}"

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...

Peter Lundin

unread,
Apr 21, 2005, 3:15:03 PM4/21/05
to
Hi Mike,

Yes, there is a way to script MMC. This will get you started:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mmc/mmc/using_vbscript_with_the_mmc_2_0_automation_object_model.asp

Regards,
Peter Lundin

Mike Koch

unread,
Apr 21, 2005, 9:07:29 PM4/21/05
to
Thanks, Peter. I also found a simpler way to accomplish what I wanted:

Sub Manage(strPC)
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")
cmdline = "cmd.exe /c compmgmt.msc /computer=" & strPC
Set oExec = WshShell.Exec(cmdline)
End Sub


"Peter Lundin" <Peter...@discussions.microsoft.com> wrote in message
news:51C1D56C-4004-4124...@microsoft.com...

0 new messages