Simple WMI Script to Shutdown A Computer

Category:
System/API
Type:
Snippets
Difficulty:
Beginning
Author:
Anonymous

Version Compatibility: Visual Basic Script

More information:
You can use this VBScript to query the Windows Management Instrumentation objects (WMI), get a list of operating systems running on your PC, and shut them down. This could include a remote computer if you use a UNC name. It's based on user feedback from the msgBox function. Constants were included for other options, such as reboot and logoff, that you could request from the user to allow more options, and simply capture them with the wscript.arguments collection.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: