Solved

psexec a VB script (using cscript)

Posted on 2008-06-26
7
4,381 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
  • 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Welcome to my series of short tips on migrations. Whilst based on Microsoft migrations the same principles can be applied to any type of migration. My first tip Migration Tip #1 – Source Server Health can be found listed in my profile here: http:…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

832 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