Question : Windows Scripting

Hi, I'm creating a vbs script that uses WMI, to copy an OCX file from the network and into the winnt/system32 directory. The problem I'm having is trying to figure out how to get the script to register the control as well..

to do it manually I know it's "regsvr32 .ocx" but I'm not sure how to incorporate this into a wmi script..  does anyone know I would really appreciate it.

Thanks, Justin

Answer : Windows Scripting


'create objects
Set sh = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

'get sys dir
sys = fso.GetSpecialFolder(1)
'run regsvr32 silently
sh.Run(sys & "\regsvr32.exe /S <name>.ocx")

'cleanup
Set sh = nothing
Set fso = nothing
Random Solutions  
 
programming4us programming4us