WMI Scripting Examples

Most of the VBScript samples were created using Microsoft's Scriptomatic tool, the KiXtart scripts were my own "translations" of the VBScript versions, most of the other scripts were generated by my WMI Code generator.
The (XP) batch files use WMIC (available in Windows XP Professional, Windows Server 2003 and Vista only).

Most, if not all, of these scripts can be used for any WMI enabled computer on the network.

 

0..9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

 

Download the ZIPped sources Click the floppy disk icons to download the ZIPped sources

 

WMI Examples
Download the ZIPped sources Sources Description Last modified
(DD/MM/YYYY)
Remarks
Download the ZIPped sources BattRun.bat Display a warning message if a program is launched while the computer is running on battery power 23/08/2007 Uses WMIC
Download the ZIPped sources BattStat.bat Display battery status 04/10/2006 Uses WMIC
Download the ZIPped sources BIOS.kix
BIOS.orx
BIOS.pl
BIOS.ps1
BIOS.vbs
Display BIOS information 09/01/2003
11/09/2006
11/09/2006
11/09/2006
30/11/2002
 
Download the ZIPped sources BootDisk.bat Determine the boot disk, partition and drive letter 26/10/2006 Uses WMIC
Download the ZIPped sources BootDriv.vbs Return boot drive letter 06/01/2003 Created using script code found in TechNet Script Center: "Disks and File Systems" section (no longer available?)
Download the ZIPped sources CDROM.kix
CDROM.vbs
Display all CD-ROM drive letters 09/01/2003
16/11/2002
 
Download the ZIPped sources CheckRes.vbs Check if the screen resolution meets a specified minimum requirement, and exit with return code 1 if not 31/05/2008  
Download the ZIPped sources COMPorts.vbs Display serial ports information 03/01/2003  
Download the ZIPped sources CPULoad.js
CPULoad.vbs
Display CPU load information 07/02/2005
05/02/2005
 
Download the ZIPped sources CPULoadTD.js
CPULoadTD.vbs
Display CPU load information in tab delimited format 07/02/2005
05/02/2005
 
Download the ZIPped sources CPUSpeed.vbs Display CPU speed for each processor 05/02/2005  
Download the ZIPped sources CPUSpeedTD.vbs Display CPU speed for each processor in tab delimited format 05/02/2005  
Download the ZIPped sources CPUType.vbs Display CPU type 05/02/2005  
Download the ZIPped sources CPUTypeTD.vbs Display CPU type in tab delimited format 05/02/2005  
Download the ZIPped sources DiskSpc.bat Display harddisk summary for any WMI enabled computer or for a list of computers 02/10/2006 Uses WMIC
Download the ZIPped sources DispEDID.vbs Display the monitor's EDID asset information 14/02/2007 Based on a script by Michael Baird
Download the ZIPped sources FreeSpace.vbs Display a disk space summary 12/10/2002  
Download the ZIPped sources GetPrint.vbs List Print and PrintTo commands for all associated file types from the registry 19/06/2008  
Download the ZIPped sources GetRAM.vbs Display the amount of physical memory installed 03/11/2002 Based on WMI Scripting Primer: Part 1 by Greg Stemp, Dean Tsaltas and Bob Wells.
Download the ZIPped sources GetRes.pl
GetRes.ps1
GetRes.vbs
Display Windows 2000's screen resolution and refresh rate 11/09/2006
11/09/2006
09/01/2003
 
Download the ZIPped sources GetRunDL.vbs List all RUNDLL(32) commands for file associations from the registry 01/01/2007  
Download the ZIPped sources GetSID.vbs Display a user's Security ID 03/12/2005  
Download the ZIPped sources Hardware.bat
Hardware.hta
Hardware.kix
Hardware.vbs
Display a basic hardware summary for any WMI enabled computer on the network 03/10/2006 11/11/2006
01/01/2006
23/11/2002
The batch file uses WMIC.
The HTA version automatically checks for updates.
Download the ZIPped sources HotFixes.vbs Display installed hotfixes 26/11/2002 Based entirely on a (now no longer available) sample script from Microsoft TechNet Script Center
Download the ZIPped sources HotFixesTD.vbs Display installed hotfixes in tab delimited format 26/11/2002 Based entirely on a (now no longer available) sample script from Microsoft TechNet Script Center
Download the ZIPped sources KillProg.vbs Kill the specified program 18/10/2002  
Download the ZIPped sources LastBoot.vbs Display the last boot time 09/12/2003  
Download the ZIPped sources Logoff.vbs Logoff current user on any WMI enabled computer 19/10/2002 Adapted from posts by Alex K. Angelopoulos on Developersdex and Michael Harris on a VBScript newsgroup.
Download the ZIPped sources MdmCmds.bat Display the available configuration commands for your modem(s) 12/10/2006 Uses WMIC
Download the ZIPped sources Memory.ps1 Display a physical memory summary 21/10/2006  
Download the ZIPped sources NICSpeed.kix
NICSpeed.vbs
Display ethernet adapter's link speed 21/01/2006
06/01/2006
 
Download the ZIPped sources PhysMem.vbs Display a physical memory summary 10/11/2002  
Download the ZIPped sources Processes.vbs Display running processes 17/10/2002  
Download the ZIPped sources PwdNoExp.bat Set "password never expires" for a local account 12/03/2008 Uses WMIC
Download the ZIPped sources ReadReg.vbs Read a value from the registry 06/04/2003 Based on "Registry functions Provided by the WMI StdRegProv class" by Andrew Mayberry.
Download the ZIPped sources Reboot.vbs Reboot any WMI enabled computer on the network 05/10/2002 Based on a post by Alex K. Angelopoulos on www.developersdex.com.
See my Shutdown page for shutdown and reboot commands for "all" operating systems.
Download the ZIPped sources SAVVer.vbs Display Symantec Antivirus program and definitions version 29/06/2006  
Download the ZIPped sources Services.kix
Services.vbs
Display all services 26/11/2002
02/11/2002
 
Download the ZIPped sources ServicesTD.vbs Display all services in TAB delimited format 02/11/2002  
Download the ZIPped sources ShareMg2.vbs Migrate all non-printer shares from one server to another 02/11/2005 Currently for Windows Server 2003, created migration script needs manual modifications afterwards for Windows 2000.
(For printer migration, use Microsoft's PrintMig; for Scheduled Tasks migration, copy the scheduled tasks -- %windir%\Tasks\*.job -- to the new server, and use JT.EXE to re-set the "Run as:" property for each migrated task.)
Download the ZIPped sources ShowCpuH.ps1 Display CPU type, clock speed & load information in HTML 01/09/2006  
Download the ZIPped sources ShowPRN.ps1
ShowPRN.vbs
Display all installed printers and their properties 10/09/2006
13/01/2004
 
Download the ZIPped sources ShowPRNH.ps1 Display all installed printers and their properties in HTML 31/08/2006  
Download the ZIPped sources ShowPRNT.vbs Display all installed printers and their properties in TAB delimited format 17/01/2004  
Download the ZIPped sources Shutdown.vbs Shut down any WMI enabled computer on the network 05/10/2002 Based on a post by Alex K. Angelopoulos on www.developersdex.com.
See my Shutdown page for shutdown and reboot commands for "all" operating systems.
Download the ZIPped sources Software.hta List installed software 17/01/2007 Automatically checks for updates.
Download the ZIPped sources SrvInv.vbs Show and log a server hardware and software inventory 14/09/2005  
Download the ZIPped sources Startup.vbs Display all startup commands (Startup folder and registry Run) 16/01/2003  
Download the ZIPped sources UpTime.vbs Display uptime for any WMI enabled computer 22/04/2006  
Download the ZIPped sources VBSNames.vbs Demonstrates several VBScript techniques to retrieve user names, computer names & domain names 22/01/2007 Demo script from my VBScript scripting techniques section.
Download the ZIPped sources VideoROM.kix
VideoROM.vbs
Display video adapter summary 09/01/2003
01/12/2002
 
Download the ZIPped sources WinVer.vbs Display the Windows version 26/07/2005  
Download the ZIPped sources WMIGen.hta This HTA generates Batch, JScript, KiXtart, Object Rexx, Perl, PowerShell, Python and VBScript code for WMI queries 20/10/2006 Automatically checks for updates.
Based on the example from the Microsoft TechNet ScriptCenter article Scripting Eye for the GUI Guy, with help from the Scripting Guys' Scriptomatic 2.0 and HTA Helpomatic tools and The Script Center Script Repository: Sample Windows PowerShell Scripts