WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

MMC

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Run MMC with Computer Management Utility and Control Event Viewer

Keywords:  MMC  Microsoft Management Console  Computer Management Utility  Event Viewer  snapins

Question:

Windows 2000 is much different than NT 4.0 in some areas. You can not hot-key your way around 2000, so if you have any programs that use the SendKey command, you will have to redo them. 2000 uses MMC's which are different. Doing a ALT-"key" does not work the same in the MMC.

I want to be able to format drives via the Computer Management MMC and to manipulate the EventVwr MMC, all under Win2K.

I guess I need to know which Extender(s) I need to use to work with the MMC's in Win2000.

Answer:

To drive the MMC stuff, use the Control Manager Extender. It depends what you want to control via the MMC.

This should get you pretty close with the disk stuff...

AddExtender("wwctl34I.dll") ; Add in Control Manager extender

;Run MMC with computer management utility
compmgmt=Strcat(DirWindows(1),"compmgmt.msc")
run("mmc.exe",compmgmt)


;Using Control Manager navigate down to disk utility
topwnd=DllHwnd("Computer Management")
child2=cWndByID(topwnd,59648)
child3= cWndByID(child2,65280)
child4=cWndByID(child3,59648)
syslist=cWndByID(child4,12786)

text=cGetLVText(syslist)
x=ItemLocate("Storage",text,@tab)
cDblClickItem(syslist,x)
TimeDelay(1)

text=cGetLVText(syslist)
x=ItemLocate("Disk Management (Local)",text,@tab)
cDblClickItem(syslist,x)
TimeDelay(1)

; ok now we have the disk stuff up.  Figure out drives available.
;Since window has change so much, lets walk the window tree again

topwnd=DllHwnd("Computer Management")
child2=cWndByID(topwnd,59648)
child3= cWndByID(child2,65280)
child4=cWndByID(child3,59648)
child5=cWndByID(child4,12789)
;Eeeek  Analysis script ran out of steam.
;Downloaded sinfo.exe freeware utility from Spain to continue
child6=cWndByClass(child5,"AfxOleControl42u")
syslist=CWndByID(child6,102)
syshdr=cWndByClass(syslist,"SysHeader32")

TimeDelay(5) ; wait for disk scan to complete

text=cGetLVText(syslist)
text=Strreplace(text," ","") ; strip spaces
;header=cGetHRText(syshdr)
x=ItemLocate("(C:)",text,@tab)    ; Drive to format goes here
;message(x,text)
cDblClickItem(syslist,x)
TimeDelay(1)

;>>> Add additonal code here (maybe sendkeysto) to format <<<


Article ID:   W14625
Filename:   Run MMC with Computer Management Utility.txt
File Created: 2001:03:01:14:31:36
Last Updated: 2001:03:01:14:31:36