Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Tue, 6 May 2008 02:28:50 -0700 (PDT),    group: microsoft.public.win32.programmer.wmi        back       


mofcomp related question   
Hi all,

Is there any silent mode to registering a .mof file with mofcomp? I
dont want a command line to come up when I execute that command. Any
ideas?
date: Tue, 6 May 2008 02:28:50 -0700 (PDT)   author:   unknown

Re: mofcomp related question   
On May 6, 4:28 am, vidyasagar....@gmail.com wrote:
> Hi all,
>
> Is there any silent mode to registering a .moffile with mofcomp? I
> dont want a command line to come up when I execute that command. Any
> ideas?

Can you use vbscript?  something like the below, where the mini.mof
file is in the same folder as the vbscript.

On Error Resume Next
Set sho = CreateObject("WScript.Shell")
strSystemRoot = sho.expandenvironmentstrings("%SystemRoot%")
strCurrentDir = Left(Wscript.ScriptFullName,
(InstrRev(Wscript.ScriptFullName, "\") -1))
'Parse Command Line
strAddWMIClasses = strSystemRoot & "\System32\wbem\mofcomp " & chr(34)
& strCurrentDir & "\MINI.mof" & chr(34)
sho.run "cmd /c " & strAddWMIClasses,vbHide
date: Tue, 6 May 2008 15:33:46 -0700 (PDT)   author:   unknown

Re: mofcomp related question   
> > Is there any silent mode to registering a .moffile with mofcomp? I
> > dont want a command line to come up when I execute that command. Any
> > ideas?


Also,

Set WshShell = CreateObject("WScript.Shell")

Set oExec = WshShell.Exec("mofcomp mymof.mof")

Do Until oExec.StdOut.AtEndOfStream

  strStdOut = oExec.StdOut.Readline

  wscript.echo strStdOut

Loop

You can choose not to display the output from the mofcomp command or
parse it to see if it was successful etc.


There are Scripting and COM APIs for WMI:

http://msdn.microsoft.com/en-us/library/aa393258(VS.85).aspx

that will allow you to perform the functions of mofcomp
programmatically (I've use it for event registration, for example) but
I suspect that may be a more complicated route than you are looking
for?

Dominic
date: Wed, 7 May 2008 00:46:52 -0700 (PDT)   author:   Dominic Johnson

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us