Solved

logon script to distribute a file and register it with regsvr32.exe on multiple workstations

Posted on 2004-10-06
4
608 Views
Last Modified: 2008-01-09
I need someone to please give me an example vbs that will disctribue an *.ocx file on windows workstations and then register it on that workstation with regsvr32.exe

I currently have a universal logon script for mapping of network drives and printers.  I would like for this to be able to be added to this script.  

Lastly, this script should be able to determine if the file registration has already occurred.  If it has, then skip it.

Thank you!
0
Comment
Question by:jcarnevale
4 Comments
 
LVL 28

Accepted Solution

by:
vinnyd79 earned 500 total points
ID: 12362426
Dim fso ,WinSysDir,WshShell,intresult

set fso = CreateObject("Scripting.FileSystemObject")

Set WinSysDir = fso.GetSpecialFolder(1)

' copy menubar.ocx from server share to workstation's system dir
fso.CopyFile "\\server\share\Menubar.ocx",WinSysDir & "\MenuBar.ocx"
set fso = nothing

' if not registered, then register
set WshShell = WScript.CreateObject("WScript.Shell")
intResult = RegDLL(WinSysDir & "\MenuBar.ocx")
' intResult = 0 if sucess

set WshShell = Nothing

Function RegDLL(strDLL)
  ' add extra quotes in case there are spaces
  strDLL = QUOTE & strDLL & QUOTE
  RegDLL = WshShell.Run("regsvr32 /s " & strDLL, 6, True)
End Function
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question