• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 398
  • Last Modified:

Batch File creation: Help Needed

I need some assistance in the creation of a batch file.

Lamens:

1. Batch file is run and the first thing it does is run a vbscript located in the same folder.
2. Once the vbscript is finished, the batch file restarts the machine.

I have a notion it has something to do with the exit code as to why my current script is not continuing after the .vbs has ran.  If I was not clear in any way forgive me, just ask and I will be glad to answer and additional questions you may have.

@Echo Off
cscript script.vbs
shutdown -r -c "Custom Message" -t 120

Open in new window

0
SOSTechteam
Asked:
SOSTechteam
  • 3
  • 2
3 Solutions
 
SysExpertCommented:
try
call cscript script.vbs

Otherwise the script may simply not ever reach the next line

alternatively use the shell command in your VBscript to do the shutdown.
 
I hope this helps !
0
 
Malli BoppeCommented:
The scriot works fine I have tested with a sample VB script.
It could be the problem with your VBscript which doesn't exit properly.
0
 
SOSTechteamAuthor Commented:
Thanks for the replies, I should have mentioned this, since I believe it is where the issue lies.

The users running the batch are not administrators, so they are unable to execute the 'shutdown' command.

Which leads me to a great question how can I get the batch file to run the shutdown command as administrator without having the password entered each time the batch is ran?
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
Malli BoppeCommented:
Are they running it on the local machine or through terminal services.
What error do they get.
0
 
SOSTechteamAuthor Commented:
Found a solution: using runasscp to execute the shutdown command has worked beautifully.
0
 
SOSTechteamAuthor Commented:
I was on the right track, but the admin rights is what was hanging me up.  Runasscp solved this issue and everything is gravy now.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now