Solved

psexec a VB script (using cscript)

Posted on 2008-06-26
7
4,344 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
Why spend so long doing email signature updates?

Do you spend loads of your time carrying out email signature updates? Not very interesting are they? Don’t let signature updates get you down. Let Exclaimer Cloud - Signatures for Office 365 make managing email signatures a breeze.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

My previous article  (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/Windows_Server_2008/A_4466-A-beginners-guide-to-installing-SCCM2007-on-Windows-2008-R2-Server.html)detailed one possible method to get SCCM 2007 installed an…
Some time ago I faced the need to use a uniform folder structure that spanned across numerous sites of an enterprise to be used as a common repository for the Software packages of the Configuration Manager 2007 infrastructure. Because the procedu…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

26 Experts available now in Live!

Get 1:1 Help Now