Solved

Using Psexec in Vbscript to Register DLL on Remote Machine

Posted on 2012-04-06
11
1,195 Views
Last Modified: 2012-04-06
Hello,

I am trying to use psexec in a vbscript to register a dll on remote machines.  The below syntax does not appear to be working.  Can you suggest what is wrong with the syntax?

strFile = " \\" & strComputer & " "

Set wshShell = CreateObject("WScript.Shell")


intRegister = wshShell.Run("C:\temp\pstools\psexec.exe" & strFile & "regsrv32.exe /s c:\winnt\system32\some.dll")


Any help would be greatly appreciated.

Thanks
Diammond
0
Comment
Question by:Diammond
  • 4
  • 4
  • 3
11 Comments
 
LVL 17

Expert Comment

by:Anuroopsundd
Comment Utility
is the psexec already copied locally in remote machine?
0
 
LVL 17

Expert Comment

by:Anuroopsundd
Comment Utility
strFile = " & strComputer & "
Set wshShell = CreateObject("WScript.Shell")

intRegister = wshShell.Run("C:\temp\pstools\psexec.exe \\” & strComputer & "regsrv32.exe /s c:\winnt\system32\some.dll")


try above.....
0
 

Author Comment

by:Diammond
Comment Utility
Hello,

Thanks for responding.  No, it's being executed from my computer.  I can type the command at a DOS prompt and it registers the remote dll.  It is not working via the script.
0
 
LVL 17

Expert Comment

by:Anuroopsundd
Comment Utility
Set wshShell = CreateObject("WScript.Shell")

intRegister = wshShell.Run("C:\temp\pstools\psexec.exe \\” & strComputer & " regsrv32.exe /s c:\winnt\system32\some.dll")


Ok.. can you try above script..
0
 

Author Comment

by:Diammond
Comment Utility
New syntax is failing as well.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 74

Expert Comment

by:käµfm³d 👽
Comment Utility
Do you have rights on the remote machine?
0
 

Author Comment

by:Diammond
Comment Utility
Thanks for responding.  

Yes, I have admin rights and I can also run the command successfully from a DOS prompt.  There is a syntax error somewhere in the code.
0
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 350 total points
Comment Utility
The register command is regsvr32 I believe. I think you have the "r" and "v" transposed. Try:

intRegister = wshShell.Run("C:\temp\pstools\psexec.exe" & strFile & "regsvr32.exe /s c:\winnt\system32\some.dll")

Open in new window

0
 
LVL 17

Expert Comment

by:Anuroopsundd
Comment Utility
Nice catch......
0
 

Author Comment

by:Diammond
Comment Utility
I'm so embarrassed.  Sometimes it takes an extra pair of eyes.

Thanks all for your help!

Diammond
0
 
LVL 74

Expert Comment

by:käµfm³d 👽
Comment Utility
Sometimes it takes an extra pair of eyes.
I think that's one of the tenets of software development  = )
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now