Solved

psexec a VB script (using cscript)

Posted on 2008-06-26
7
4,412 Views
Last Modified: 2013-12-05
Hi,

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.
0
Comment
Question by:bryanatm
[X]
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
7 Comments
 
LVL 13

Expert Comment

by:TheCapedPlodder
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
0
 
LVL 1

Author Comment

by:bryanatm
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.
0
 
LVL 13

Expert Comment

by:TheCapedPlodder
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

correct?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:bryanatm
ID: 21885409
Almost, but not quite.

CAN DO:
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

CAN'T DO:
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.


0
 
LVL 1

Author Comment

by:bryanatm
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>
0
 
LVL 13

Accepted Solution

by:
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.
0
 
LVL 1

Author Comment

by:bryanatm
ID: 21904357
Thanks all.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Enterprise Mode 4 72
Deploying packaged application using SCCM steps ? 4 93
domain and forest trust 1 55
harddrive crash 6 43
Remote Apps is a feature in server 2008 which allows users to run applications off Remote Desktop Servers without having to log into them to run the applications.  The user can either have a desktop shortcut installed or go through the web portal to…
Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

751 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