Shaun Cassells at MyITForum.com

SMS 2003 and ConfigMgr 2007, PowerShell, Scripting, Finance, Fitness and Fun

News

Locations of visitors to this page

Registering a DLL in a Script

To register a Dynamic Link Library (DLL) in Microsoft we use Regsvr32.exe to: LoadLibrary() is called to load the control into memory, GetProcAddress() is called to get the address of the DllRegisterServer() function, and then DllRegisterServer() is called to register the control.  When working with a VBS script you have two methods of RegSvr32.exe: WMI example

REG = windir & "\system32\regsvr32.exe /s " & windir & "\system32\msxml3.dll"

Set oWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & Computer & "\root\cimv2:Win32_Process")

result = oWMIService.Create(REG , Null, Null, intProcessID)

 

WshShell.run example

reg = "cmd /C regsvr32.exe -s %windir%\system32\wbem\wmisvc.dll"
rc = WshShell.run(reg , 2, 1)

  

Regsvr32.exe usage and error messages

http://support.microsoft.com/kb/249873

 

Possible Reasons for OLE control Registration Failure

http://support.microsoft.com/kb/140346/

 

Run Method (Windows Script Host)

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

Comments

No Comments