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?
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
> > 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