psexec a VB script (using cscript)

Posted on 2008-06-26
Last Modified: 2013-12-05

My goal is this:
psexec \\* cscript \\server\c$\script\my_script.vbs

It works on the client:
cscript \\server\c$\script\my_script.vbs

But it doesn't work via psexec from server to client:
psexec \\client cscript \\server\c$\script\my_script.vbs

The error message is "Access denied".  I have tried creating a normal windows share but it still says the same thing.  I have even tried adding different permissions, such as allow "Everyone" to have "Full" permissions and it still doesn't work.

Any help would be greatly appreciated.
Question by:bryanatm
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 13

Expert Comment

ID: 21878507
Does the user account you are running have admin rights on the remote client?  Can you browse \\server\c$ without changing credentials e.g. dir \\server\c$

If not you can specify admin rights on the psexec command:

psexec \\server -u domain\username -p password cscript.exe c:\my_script.vbs

Author Comment

ID: 21878781
On the client, as the same user I can do this:

dir \\server\c$

And it works fine with no problems.

In fact I can even do the next one too and it works with no problems:

cscript \\server\c$\script\my_script.vbs

Unfortunately I don't know the admin password and haven't logged in as admin for this project.  I created the c:\script folder as the bryan user by typing "md \\server\c$\script" and also "md \\client\c$\script".  I was on the server when I did those commands.
LVL 13

Expert Comment

ID: 21881624
OK.  So you're on the server and can do this:

dir \\client\c$\script\my_script.vbs

But you can't do this:

psexec \\client c:\script\my_script.vbs

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now


Author Comment

ID: 21885409
Almost, but not quite.

on client -> start -> run -> cmd -> dir \\server\c$\script
on client -> start -> run -> cmd -> cscript \\server\c$\script\backup.vbs

*on server -> start -> run -> cmd -> copy c:\script\backup.vbs \\client\c$\script
*on server -> start -> run -> cmd -> psexec \\client c:\script\backup.vbs

on server -> start -> run -> cmd -> psexec \\client \\server\c$\script\backup.vbs

Notice the ones marked with asterisks.  I am copying the file to the client first, then executing the vb script locally.  What I want is to execute the vbscript from a network location.  For some reason it doesn't work.


Author Comment

ID: 21887562
I have found out a workaround.  If I use the -u and -p options to specify a user name and pass word then I can use the network shares.  I think the program does not allow networking unless one specifies the user name and pass word.<br><br><span style="font-weight: bold;">psexec \\client -<span style="font-style: italic;">u bryan -p 12345 </span>\\server\c$\script\backup.vbs<br><br></span>Is there a way to make it work without specifying the user name and the pass word?<span style="font-weight: bold;"><br></span>
LVL 13

Accepted Solution

TheCapedPlodder earned 500 total points
ID: 21887743
The only other option I can think of is to use the -c option to copy the file to the server before it is executed.

Personally I always copies the file to the server before I execute it to make life easier.

Author Comment

ID: 21904357
Thanks all.

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

A quick step-by-step overview of installing and configuring Carbonite Server Backup.
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

634 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