General discussion

Locked

Running bat file using a VBS script

By umang.jay ·
Hi All
I new to this website, so please forgive me if I'm doing this wrong.

I need help with trying to run a bat file once a user has logged on the the domain. basically I am trying to get a pop up to appear informing the user that the PC is shutting down as it is in the wrong OU. please call IT for Help.

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?

This conversation is currently closed to new comments.

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

All Comments

Back to Web Development Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums