Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Register dll

370 views
Skip to first unread message

systemtek

unread,
Mar 4, 2008, 10:14:16 AM3/4/08
to
Hi All, I know how to register a .dll on my own PC as followes :

Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run "regsvr32.exe c:\windows\system32\whatever.dll"

But how do i register a .dll on another PC, i mean i want to run the
script on my PC so it will connect to the listed PC/PC's and register
a dll on them ?

Thanks

Richard Mueller [MVP]

unread,
Mar 4, 2008, 12:23:27 PM3/4/08
to
systemtek wrote:

This can be done, but involves several steps.

1. Use WMI to connect to the remote computers. It is best to first ping the
machines to avoid the long timeout if any are not available.
2. Copy an executable to the remote computer. This can be a batch file or
VBScript similar to your example. It must run silently with no user
intervention, since there will be no user.
3. Run the executable on the remote computer.
4. Wait for the executable to complete and then delete it.

I have an example VBScript program that does this for all computer objects
in a group linked here:

http://www.rlmueller.net/Deploy.htm

I use an Active Directory group because this is easy to manage. The script
keeps a detailed log. It doesn't matter if anyone is logged on to the
computers or not, but they must be powered on and authenticated to the
domain.

I would suggest you use a command similar to:

strCmd = "%comspec% /c regsvr32 /s ""%SystemRoot%\system32\whatever.dll"""
objShell.Run(strCmd, 2, True)

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--


Corey Thomas - MCSE/MCSA/MCDBA

unread,
Mar 7, 2008, 5:33:03 PM3/7/08
to
Richard has a lot of good tips about pinging the machines first and copying
the files (both of which are things I do as well).

Here is a snippet of code I use to kick off EXE's on a machine. You might
be able to use this to run regsvr32.exe xxx.dll. I can't confirm that it
will work, but it might.

'=====================================
Function startExe(strComputer,strEXE)

startExe = False
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")

Error = objWMIService.Create(strEXE, Null, Null, intProcessID)

If Error = 0 Then
Wscript.Echo strExe & " was started with a process ID of " _
& intProcessID & "."
startExe = True
Else
Wscript.Echo strEXE & " could not be started due to error " & _
Error & "."
objExcel.Cells(intExcelRow, hdrError).Value = "EXE could not be
started"

End If


End Function
'=====================================

To use:

strCMD = "regsvr32.exe c:\mycomponent.dll"
strRemoteMachine = "bobsComputer"

if startExe(strRemoteMachine,strCMD) then
wscript.echo "Regsvr32 ran"
else
wscript.echo "Regsvr32 did no run"
end if


-Corey Thomas
MCSE/MCSA/MCDBA

0 new messages