You are not logged in.

#1 26 Oct 2014 23:22

chouse
New Member
Registered: 26 Oct 2014
Posts: 2

CMD auth in VB script -- permission problem

Hello,

I have a script like:

Option Explicit
Dim objShell

Set objShell = WScript.CreateObject ("WScript.shell")
objShell.run "cmd /K CD C:\ & Dir"
Set objShell = Nothing

When I am logged on as Admin, this script runs fine from the prompt on local (test machine) as well as on remote server (production server).
It also works fine when I use the browser (web server) on local machine.

Problem is that it does NOT work on remote server when I use the browser. I think it is the user account which executes the command and I am looking for a solution which allows the browser account to run this command.

Thanks
Ken

Offline

#2 27 Oct 2014 06:11

foxidrive
Member
Registered: 04 Apr 2013
Posts: 339

Re: CMD auth in VB script -- permission problem

What error do you see on the screen?

Offline

#3 28 Oct 2014 04:16

chouse
New Member
Registered: 26 Oct 2014
Posts: 2

Re: CMD auth in VB script -- permission problem

The error message that I get depends on objShell.RUN "xxxxxxxxx" command line which I try to run. For example, if I run a BCP command (MS SQL) I see no error message AND no result (appears as totally ignored command) or rarely, there the message is error 28000 (failed authentication user+password info).

As I mentioned the account which invokes the Shell / CMD is important and the browser account does not have that authority to perform (Windows 7). The same command (plus same SQL user+password) performs perfect when I connect as Administrator and start CMD manually.

Thanks,
Ken

Offline

#4 29 Dec 2014 10:56

tomjery
New Member
Registered: 05 Dec 2014
Posts: 2

Re: CMD auth in VB script -- permission problem

Dim objWMIService, colProcessList
  Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'outlook.exe'")



________________________________________

Offline

Board footer

Powered by