Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing vbs script on file share 1

Status
Not open for further replies.

theniteowl

Programmer
May 24, 2005
1,975
US
Hi All,
This should be simple but it is eluding me.
I am using PSExec to connect to server 1 passing a command line that executes a vbs script on server 2.
This works fine on 4 servers. One server just got back from being rebuilt after a HD crash. Now this server cannot execute the script that resides on the network share but it will execute it if the file is on a local drive.

There is probably a setting on the system preventing this from working but I have been unable to find it.

The command I issue is as follows.
Code:
objShell.Run "cmd /c \\server1\myfolder\psexec.exe \\" & strServerName & " -u " & strServerName & "\loginid -p password cmd.exe /c \\server1\myfolder\chklogin.vbs", 0, True

PSExec connects to server2 (the newly rebuilt one) and executes cmd.exe with the path to the chklogin.vbs file located on a file share on server1.
If I change the path to a local drive for chklogin.vbs it executes but I do not want to have separate copies of the script on every server and all other servers are working correctly so...
The logon ID on the server has full access to the share folder.

Ideas?

At my age I still learn something new every day, but I forget two others.
 
psexec can be fickle at times. I use it to install VBS services and run vbs scripts remotely. But I tend to have issue with filespecs.

If the command runs completely from the local disk, psexec may be requiring local drive mounts. It doesn't make sense considering the script runs on 4 other servers but you may want to try mapping a drive first and using a that instead of UNC:

net use x: \\server1\myfolder
psexec \\computer x:\chklogin.vbs

However, considering the server was just rebuilt, I bet it is a licensing issue. PSExec requires that you agree to the license before use - it is per user, not per machine. The reason being is because PSExec runs commands in your namespace. Agree to the license for you namespace on the remote machine and that should alleviate your issue (if licensing is the culprit.

[HKEY_USERS\yourSID\Software\Sysinternals\PsExec]
"EulaAccepted"=dword:00000001

Notice the license reg path is in the HKEY_USERS hive.
The key can also be found in the HKEY_CURRENT_USER hive, however, HKCU is not accessable remotely; HKU is.

Hope this helps

-Geates


 
Geates, that did turn out to be one part of the problem.
Wonder how I managed to indirectly execute this on the other 4 servers locally before doing it remotely so I did not run into it on them.

In any case, after I executed PSExec locally and accepted the terms I was then able to execute the script but it caused a Windows popup security warning for the file because it is being executed from a remote file share.
I worked around this by adding the server to IE's trusted zone which prevents the popup from occurring.
I know there is another way to handle this but could not remember what it is or find it on the web as yet. The other servers did not have to have the remote share added to their trusted zones to work so I suspect there is a way to turn off that security warning.
If I remember correctly this problem plagued us in the past when doing security patches and the patches being located on the share.

Thanks for the help.

At my age I still learn something new every day, but I forget two others.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top