[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

vbscript that can tell if the user asked for a shutdown or restart

Posted on 2008-10-09
2
Medium Priority
?
543 Views
Last Modified: 2008-10-10
Sorry I am really new to this.  im trying to write a logoff vbscript that can tell if my users requested to shutdown the computer or reboot it.
sort of like:
if reboot then X
if shutdown then Y

can someone provide me with some sample code that would accomplish this seemlessly without them needing to do any extra steps.

the purpose for this is to create a way for my users to quickly reboot their machines during work hours by bypassing large portions of the logoff script that typically take a lot of time.  Since my users dont work regular hours, i cant simply create a between the hours of arguement.

thank you for your reply
0
Comment
Question by:koffea
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
Hubasan earned 800 total points
ID: 22680017
This is a simple logic question and the easiest way to do this I believe would be this:

1) instead of your users going to START/Reboot or Shutdown, you would create a batch file or VB script for them to restart or shutdown the PC.
2) This script would create a flag file depending on which action was requested: Reboot or shutdown.
3) Logoff script would detect this flag file (can be ordinary txt file) and bypass the logoff routine, and at the end would just delete that flag file. (or you can have startup/logon script delete the flag file). Last step is important because you don't want to leave that flag file since you don't want the to ALWAYS bypass the logoff script.

Example of restart request:
-User x wants to reboot the PC quickly and clicks on the shortcut on the desktop called "Quick reboot"
-This shortcut starts the batch file or VB Script that creates a flag file in C:\ drive called REBOOT.txt, and then initiates the "Shutdown -r" command to reboot the pc.
-Logoff script then recognizes that REBOOT.txt file exists with "IF EXIST "C:\Reboot.txt" then "bypass logoff script" and quickly restarts the PC.
0
 

Author Comment

by:koffea
ID: 22690917
i was hoping for something a lttle more transparent and seemless.  But your solution definitely works.  thanks.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question