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

Re: Register dll by Richard

Richard
Tue Mar 04 11:23:27 CST 2008

systemtek wrote:

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

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



RE: Register dll by CoreyThomasMCSEMCSAMCDBA

CoreyThomasMCSEMCSAMCDBA
Fri Mar 07 16:33:03 CST 2008

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


"systemtek" wrote:

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