• Home
  • About 404TS
  • Contact

404 Tech Support

Where IT Help is Found

  • Articles
    • Code
    • Entertainment
    • Going Green
    • Hardware, Gadgets, and Products
    • Management
    • Network
    • News
    • Operating Systems
    • Security and Privacy
    • Software
    • System Administration
    • Talking Points
    • Tech Solutions
    • Web
    • Webmaster
  • Reviews
  • Media
    • Infographics
    • Videos
  • Tech Events
  • Tools
    • How do I find my IP address?
    • Browser and plugin tests
  • Get a Technical Consultation
You are here: Home / Articles / Code / Restart Script without Admin privileges

Restart Script without Admin privileges

2008-12-04 by Jason

If you’re trying to script a restart function for users, you’ll unfortunately find that shutdown.exe does not work for non-Administrators, nor does psshutdown. Shutdown.exe requires privileges for the shutdown process and psshutdown.exe requires privileges to add and start services.

One of many ways around this problem is to create a visual basic script. This also offers the functionality of allowing the user to abort the restart with a simple cancel button, a functionality which shutdown.exe lacks (unless your user runs shutdown.exe -a within the time limit).

Create a text document in Notepad or Notepad++ and paste in the following code. Save the file as restart.vbs. You may have to uncheck ‘hide extensions of known file types’ so that your file doesn’t end up named restart.vbs.txt and behave like a text file.

Const wshOK = 1
Const wshCancel = 2
Const wshvbOKCancel = 1
Set objShell = CreateObject("Wscript.Shell")
intReturn = objShell.Popup("System will restart in 5 seconds.",5, "System Restart", wshvbOKCancel)
If intReturn = wshCancel Then
Wscript.Quit
Else
strComputer = "localhost"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\" & _
strComputer & "rootcimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Reboot()
Next
End If

When a user clicks on on the script or a shortcut to the script it will launch a simple pop-up window that states: “System will restart in 5 seconds.” with an Ok button and a Cancel button. After 5 seconds the machine will restart. If you hit Ok, the machine will restart immediately. If you hit Cancel, the restart process will stop and the machine will go back to normal operation.

Filed Under: Code

Trending

  • Using Group Policy to Deploy Adobe Acrobat 9.3.2
    In Security and Privacy, Software, System Administration
  • Palm Mojo SDK for the Palm Pre
    In Code, Hardware, Gadgets, and Products
  • The Best Uses for Laser Engraving
    In Articles, Hardware, Gadgets, and Products

Latest Media Posts

Find Out Where To Download SNES ROMs

Find Out Where To Download SNES ROMs

Multifunctional Video Conversion Tools – Wondershare Video Converter

Multifunctional Video Conversion Tools – Wondershare Video Converter

  • Popular
  • Latest
  • Today Week Month All
  • Access to the resource [servershare] has been disallowed Access to the resource [servershare] has been disallowed
  • Read the Event Logs on Windows Server Core Read the Event Logs on Windows Server Core
  • Increase IIS Private Memory Limit to improve WSUS availability Increase IIS Private Memory Limit to improve WSUS availability
  • How to ‘Unblock’ multiple files at a time with PowerShell How to 'Unblock' multiple files at a time with PowerShell
  • Setup your DFS namespace with DNS for compatibility in a mixed environment Setup your DFS namespace with DNS for compatibility in a mixed environment
  • How Virtual Reality Supports Mental Health Therapy How Virtual Reality Supports Mental Health Therapy
  • Key Strategies of Successful Coin Listing on Exchange Key Strategies of Successful Coin Listing on Exchange
  • Keeping Your Mac Healthy: A Comprehensive Guide to Maintenance and Troubleshooting Keeping Your Mac Healthy: A Comprehensive Guide to Maintenance and Troubleshooting
  • Making Distributed Software Development Work: Strategies and Best Practices for Managing Remote Teams Making Distributed Software Development Work: Strategies and Best Practices for Managing Remote Teams
  • customer contactless payment for drink with mobile phon at cafe counter bar,seller coffee shop accept payment by mobile.new normal lifestyle concept The Latest Innovations In Payment Technology
Ajax spinner

Elevator Pitch

404 Tech Support documents solutions to IT problems, shares worthwhile software and websites, and reviews hardware, consumer electronics, and technology-related books.

Subscribe to 404TS articles by email.

Recent Posts

  • How Virtual Reality Supports Mental Health Therapy
  • Key Strategies of Successful Coin Listing on Exchange
  • Keeping Your Mac Healthy: A Comprehensive Guide to Maintenance and Troubleshooting

Search

FTC Disclaimer

404TechSupport is an Amazon.com affiliate; when you click on an Amazon link from 404TS, the site gets a cut of the proceeds from whatever you buy. This site also uses Skimlinks for smart monetization of other affiliate links.
Use of this site requires displaying and viewing ads as they are presented.

Copyright © 2025 · Magazine Pro Theme on Genesis Framework · WordPress · Log in