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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[SERVER] specifying the "run" to the users computer

Status
Not open for further replies.

pr3

Programmer
Jun 12, 2002
23
CA
ok

i've asked this like a million times, just goes to show how much i need this question answered=)

i run a server through an application. and with it you can design scripts, and these scripts are written in VBScript.
and what i want to accomplish is when users enter my server
a new internet browser window will open on there computer.
however the closest i have gotten is when a user enters my server, a new window pops up on MY computer. what i have been using is...

Dim aWSHShell, bWSHShell
Set bWSHShell = CreateObject("WScript.Shell")
bWSHShell.Run "iexplore 6

so what i want to do is specify this code to open on the users computer and not on mine.


thanks in advance
 
pr3,

Basically, what you want to do is execute a command on someone else's machine to run IExplore.exe. You can't do that unless you have permissions or rights on their machine to do that. You can't just do that with any web browser either.

If you do have rights, you can use WMI to login and run that process. Try this.

cpuName = "MyServer"
strCMD = "command on remote machine"
accnt = "Remote_Account"
pwd = "Remote_Password"

ret = Remote_Cmd(Server, accnt, pwd, strCmd)


'****************************************
Function Remote_Cmd(Server, accnt, pwd, strCmd)
'****************************************
On Error Resume Next
Set Locator = CreateObject("WbemScripting.SWbemLocator")
user = server & "\" & accnt

Set Service = Locator.ConnectServer(Server, "root\cimv2", user, pwd)
Service.Security_.impersonationlevel = 3
Set Process = Service.Get("Win32_Process")
intStatus = Process.Create("cmd /C " & strCmd, null, null, intProcessId)
End Function


fengshui_1998
 
how do you get rights from the user?
 
ah
when i try to do the code i get an expected statement error
whats wrong?

thanks
 
Are you not able to put the command in the <BODY> tag of the HTML?
 
um do i put that in the code? this isnt going to be on a web page. so does it mattter? if so where do i put it?

thanks

p.s im a total newb
 
i copied and pasted it
and it says &quot;expected end of statement&quot;
 
pr3,

This is strange because I left out the semi-colon and when I submit to post the info, it puts the &quot;;&quot; back in. Anyways, remove all the semi-colons!!!

fengshui_1998
 
pr3,

The other way is by command line:

Dim aWSHShell, bWSHShell
Set bWSHShell = CreateObject(&quot;WScript.Shell&quot;)
ret = bWSHShell.Run (&quot;cmd /K &quot;&quot;c:\Program files\Internet Explorer\iexplore.exe&quot;&quot; 5)


fengshui_1998
 
lol, yeah anyway
it doesnt work!!! it does the same as

Dim aWSHShell, bWSHShell
Set bWSHShell = CreateObject(&quot;WScript.Shell&quot;)
bWSHShell.Run &quot;iexplore 6

i loads the window on my computer, not the users.
any ideas?

thanks
 
btw feng i really appreciate you helping me
hopefully you will be able to crack it for me=)
 
pr3,

If you read my comments more carefully, you have to have the rights to logon to your users computers. If you didn't need any rights, then anybody could be running anything they wanted to on anybody's computer.

Once you have logon rights, the you can combine this code

strCMD = &quot;cmd /K &quot;&quot;c:\Program files\Internet Explorer\iexplore.exe&quot;&quot;
AND THIS CODE

cpuName = &quot;MyServer&quot;
accnt = &quot;Remote_Account&quot;
pwd = &quot;Remote_Password&quot;

ret = Remote_Cmd(Server, accnt, pwd, strCmd)


'****************************************
Function Remote_Cmd(Server, accnt, pwd, strCmd)
'****************************************
On Error Resume Next
Set Locator = CreateObject(&quot;WbemScripting.SWbemLocator&quot;)
user = server & &quot;\&quot; & accnt

Set Service = Locator.ConnectServer(Server, &quot;root\cimv2&quot;, user, pwd)
Service.Security_.impersonationlevel = 3
Set Process = Service.Get(&quot;Win32_Process&quot;)
intStatus = Process.Create(&quot;cmd /C &quot; & strCmd, null, null, intProcessId)
End Function


fengshui_1998
 
pr3,

Change
cpuName = &quot;MyServer&quot;

To:
server = &quot;MyServer&quot;
' WHERE MyServer is the name of your remote machine.

 
oh, ic i must have gotten confused by your other post, i thought you said there was another way. my mistake.

anyway i tried the code you just posted, and it says
&quot;expected statement&quot;
 
pr3,

It;s working on my machine. The web pages we are using is adding an extra &quot;;&quot; into the code if you look more closely. I get the same error. See my earlier posts. REMOVE the semi-colons.

This is my last advice. I'm trying to help but if your going to get smart alecky (LOL) forget it!

fengshui_1998
 
i didnt notice that=P
thanks for you help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top