Solved

psexec a VB script (using cscript)

Posted on 2008-06-26
7
4,351 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Server 2016 licensing 11 306
SCCM Microsoft Report 2 48
OPINIONS please : best Active Directory Monitoring tool 5 115
ADMT Intra Forest migration questions 7 126
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
Learn about cloud computing and its benefits for small business owners.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

912 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

19 Experts available now in Live!

Get 1:1 Help Now