Question

Locked

Running bat file using a VBS script

By umang.jay ·
Hi there

I am trying to run a vbs script to run a bat file after a user logs into a domain. this works fine if the user logs on with admin rights but fails when a normal user logs in.
the bat file is a pop up that says this pc is in the wrong ou please contact IT.
this is what I have in my script. how do I run this without a prompt for username & password.

This is what I have in my vb script.

Set oShell = CreateObject("WSCript.shell")

sCmd = "C:\ou\Wrong_OU.bat"

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Permissions on the folder c:\ou?????

by 1bn0 In reply to Running bat file using a ...

Have you given Everyone access to the c:\ou folder?

Also what is the batch file doing?

Can the users perform the operations in the batch file manually? Or do the funtions also require admin rights?

Collapse -

Permissions on the folder c:\ou?????

by umang.jay In reply to Permissions on the folder ...

I have setup 2 bat files & 1 vbs file. to help me do this. The 1st bat file is as follows & this is the one I have added to the OU as a GPO

@ECHO OFF

xcopy %0\\..\wrong.bat %temp%\ /y/e/v
xcopy %0\\..\runasvb.vbs %temp%\ /y/e/v

cscript "%temp%\runasvb.vbs" username password %temp%\wrong.bat

The second bat file is

%windir%\system32\shutdown.exe -s -t 60 -c "Please move this Pc to the Right OU. Computer is shutting down."

The vbs file is

Set oShell = CreateObject("WSCript.shell")

sCmd = "%temp%\Wrong.bat"

for some reason It does not work. can you see where I am goin wrong?

Collapse -

Get a RUNAS program

by neilb@uk In reply to Running bat file using a ...

A couple of years ago I used one called CPAU, it's a freebie, and is a command line tool for starting process in alternate security context. You get the facility to create job files and encode the id, password, and command line in a file so it can be used by normal users. There is a CRC check so your file can't be hijacked.

Back to Software Forum
3 total posts (Page 1 of 1)  

Related Forums