Rob van der Woude's Scripting Pages

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 (only available in Windows XP Professional, Windows Server 2003 and later).

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

💾 Click the floppy disk or package (for third party scripts) 📦 icons to download the ZIPped sources

Click the question mark icons to view the MD5 and SHA1 checksums for the ZIPped sources

 

WMI Examples
💾 Click the question mark icons to view the MD5 and SHA1 checksums for the ZIPped sources Sources Description Last modified
(yyyy-mm-dd)
Remarks
💾 BattRun.bat Display a warning message if a program is launched while the computer is running on battery power 2007-08-23 Uses WMIC.
💾 BattStat.bat Display battery status 2006-10-04 Uses WMIC.
💾 BIOS.kix Display BIOS information 2003-01-09  
💾 BIOS.orx Display BIOS information 2006-09-11  
💾 BIOS.pl Display BIOS information 2006-09-11  
💾 BIOS.ps1 Display BIOS information 2006-09-11  
💾 BIOS.vbs Display BIOS information 2002-11-30  
💾 BootDisk.bat Determine the boot disk, partition and drive letter 2012-01-07 Uses WMIC.
💾 BootDriv.vbs Return boot drive letter 2003-01-06 Created using script code found in TechNet Script Center: "Disks and File Systems" section (no longer available?)
💾 CDROM.kix Display all CD-ROM drive letters 2003-01-09  
💾 CDROM.vbs Display all CD-ROM drive letters 2002-11-16  
💾 CheckRegAccess.bat Check if you have the required permissions on the specified registry key 2010-07-08 Uses WMIC.
💾 CheckRes.vbs Check if the screen resolution meets a specified minimum requirement, and exit with return code 1 if not 2010-09-16  
💾 ChkPath.bat Verify if all PATH entries are valid directories 2015-05-11 Uses WMIC.
💾 ChkPath.vbs Verify if all PATH entries are valid directories, and optionally correct errors 2018-05-16  
💾 COMPorts.vbs Display serial ports information 2003-01-03  
💾 CPULoad.bat Display CPU load information 2010-06-23 Uses WMIC.
💾 CPULoad.js Display CPU load information 2005-02-07  
💾 CPULoad.vbs Display CPU load information 2005-02-07  
💾 CPULoadTD.js Display CPU load information in tab delimited format 2005-02-07  
💾 CPULoadTD.vbs Display CPU load information in tab delimited format 2005-02-07  
💾 CPUSpeed.vbs Display CPU speed for each processor 2005-02-05  
💾 CPUSpeedTD.vbs Display CPU speed for each processor in tab delimited format 2005-02-05  
💾 CPUType.vbs Display CPU type 2005-02-05  
💾 CPUTypeTD.vbs Display CPU type in tab delimited format 2005-02-05  
💾 DatePart.cmd Display the specified part of the current date or time 2008-11-15 Uses WMIC.
💾 DiskSpc.bat Display harddisk summary for any WMI enabled computer or for a list of computers 2006-10-02 Uses WMIC.
💾 DiskTypes.vbs List harddisk and CDROM drives and their interface type (IDE/SATA/SCSI) 2012-08-07 Differentiates between IDE and SATA based on the harddisk controller's description field
💾 DispEDID.vbs Display the monitor's EDID asset information 2010-05-27 Based on a script by Michael Baird (link no longer available).
💾 DNSServers.bat List the configured DNS servers for each network adapter 2011-11-17 Uses WMIC.
💾 Drives.bat List drive letters and their drive types 2012-04-20 Uses WMIC.
💾 FreeSpace.vbs Display a disk space summary 2002-10-12  
💾 GetPrint.vbs List Print and PrintTo commands for all associated file types from the registry 2008-06-19  
💾 GetRAM.vbs Display the amount of physical memory installed 2002-11-03 Based on WMI Scripting Primer: Part 1 by Greg Stemp, Dean Tsaltas and Bob Wells.
💾 GetRes.pl Display Windows 2000's screen resolution and refresh rate 2006-09-11  
💾 GetRes.ps1 Display Windows 2000's screen resolution and refresh rate 2006-09-11  
💾 GetRes.vbs Display Windows 2000's screen resolution and refresh rate 2003-01-09  
💾 GetSID.vbs Display a user's Security ID 2005-12-03  
💾 Hardware.bat Display a basic hardware summary for any WMI enabled computer on the network 2006-10-03 Uses WMIC.
💾   Hardware.hta Display a basic hardware summary for any WMI enabled computer on the network 2023-04-09 Automatically checks for updates.
💾 Hardware.kix Display a basic hardware summary for any WMI enabled computer on the network 2006-01-01  
💾 Hardware.vbs Display a basic hardware summary for any WMI enabled computer on the network 2013-01-11  
💾 HasHardware.exe Check the actual number of keyboards, monitors and mice connected at this very moment 2024-03-21 Elevated privileges preferred but not required.
💾 HasMouse.bat Check the actual number of mice connected at this very moment 2024-03-11 Requires elevated privileges.
💾 HasMouse.exe Check the actual number of mice connected at this very moment 2024-03-11 Requires elevated privileges.
💾 HasMonitor.exe Check the actual number of monitors connected at this very moment 2024-03-09 Compiled modified WMI Code Generator generated C# code.
💾 HotFixes.vbs Display installed hotfixes 2002-11-26 Based entirely on a (now no longer available) sample script from Microsoft TechNet Script Center.
💾 HotFixesTD.vbs Display installed hotfixes in tab delimited format 2002-11-26 Based entirely on a (now no longer available) sample script from Microsoft TechNet Script Center.
💾 is6432os.bat Check if a Windows is 32-bit or 64-bit 2010-08-01 Uses WMIC.
💾 is6432os.vbs Check if a Windows is 32-bit or 64-bit 2010-07-04  
💾 is6432os.exe Check if the OS is 32-bit or 64-bit 2010-07-04 Compiled "pruned" WMI Code Generator generated C# code.
💾 IsCDWriter.ps1 Check whether the specified drive is a CD/DVD writer or not 2017-08-15  
💾 IsCDWriter.tcl 2017-08-21
💾 IsCDWriter.vbs 2017-08-14
💾 IsDST.bat Check if the current or specified date/time is in Daylight Saving Time 2011-04-12 Will temporarily change the system date up to 65 times.
Do not use on computers that are member of a domain.
Use entirely at your own risk.
VBScript and C# versions are safer to use.
💾 isDST.exe Check if the current or specified date/time is in Daylight Saving Time 2023-05-02  
💾 IsDST.vbs Check if the current or specified date/time is in Daylight Saving Time 2011-04-11  
💾 IsDuplexPrinter.bat Check if a printer is capable of duplex (two-sided) printing 2018-02-19  
💾 KillProg.vbs Kill the specified program 2002-10-18  
💾 LastBoot.vbs Display the last boot time 2009-09-25  
💾 ListDrives.exe List all logical drives for the specified computer 2022-12-03 Compiled "pruned" WMI Code Generator generated C# code.
💾 ListHDDs.bat List all physical harddisk models on a remote PC 2009-12-02 Requires either WMIC or DEVCON; if neither is available, you will be prompted to open the DEVCON download page.
💾 ListNICs.exe List physical network adapters 2011-11-01  
💾 ListPrinters.exe List all printers available on the specified computer 2011-04-06 Compiled "pruned" WMI Code Generator generated C# code.
💾 ListPrinters.tcl List all printers available on the local computer 2017-08-23  
💾 ListWMIClasses.bat List a tiny fraction of the available WMI classes in the "root\CIMV2" namespace 2010-09-29 Uses WMIC.
💾 ListWMIClasses.vbs List all available WMI classes in the specified (or default) namespace 2011-08-04  
💾 Logoff.vbs Logoff current user on any WMI enabled computer 2002-10-19 Adapted from posts by Alex K. Angelopoulos on Developersdex.com and Michael Harris on a VBScript newsgroup.
💾 MdmCmds.bat Display the available configuration commands for your modem(s) 2006-10-12 Uses WMIC.
💾 Memory.ps1 Display a physical memory summary 2006-10-21  
💾 NICSpeed.bat Display active physical ethernet adapters' link speed 2010-09-16 Uses WMIC.
💾 NICSpeed.kix Display ethernet adapters' link speed 2006-01-21  
💾 NICSpeed.vbs Display ethernet adapters' link speed 2006-01-06  
💾 PausePrinting.bat Pause printing on the specified printer 2010-07-11 Use ResumePrinting to resume printing again.
💾 PausePrinting.vbs Pause printing on the specified printer 2010-07-11 Use ResumePrinting to resume printing again.
💾 PhysMem.vbs Display a physical memory summary 2002-11-10  
💾 Printing.bat List printers with status and number of printjobs, or pause or resume printing on the specified printer(s), or flush all printjobs, or list all printers, their status and number of printjobs 2010-09-14 Uses WMIC.
Combines ListPrinters, PausePrinting and ResumePrinting and adds functionality to cancel all printjobs.
💾 Printing.exe List printers with status and number of printjobs, or pause or resume printing on the specified printer(s), or flush all printjobs, or list all printers, their status and number of printjobs 2016-02-15 Combines ListPrinters, PausePrinting and ResumePrinting and adds functionality to cancel all printjobs.
Created with (a lot of) assistance from Bas van der Woude.
💾 Printing.vbs List printers with status and number of printjobs, or pause or resume printing on the specified printer(s), or flush all printjobs, or list all printers, their status and number of printjobs 2010-09-15 Combines ListPrinters, PausePrinting and ResumePrinting and adds functionality to cancel all printjobs.
💾 Processes.vbs Display running processes 2002-10-17  
💾 PwdNoExp.bat Set "password never expires" for a local account 2008-03-12 Uses WMIC.
💾 ReadReg.vbs Read a value from the registry 2003-04-06 Based on "Registry functions Provided by the WMI StdRegProv class" by Andrew Mayberry.
💾 Reboot.vbs Reboot any WMI enabled computer on the network 2007-11-21 Based on a post by Alex K. Angelopoulos on Developersdex.com.
See my Shutdown page for shutdown and reboot commands for "all" operating systems.
💾 ResumePrinting.bat Resume printing on the specified printer 2010-07-11 Use PausePrinting to pause printing.
💾 ResumePrinting.vbs Resume printing on the specified printer 2010-07-11 Use PausePrinting to pause printing.
💾 SAVVer.vbs Display Symantec Antivirus program and definitions version    
💾 SecStat.bat Display a SecurityCenter status overview 2010-01-18 Requires Windows XP SP2 or SP3.
Use WBEMTEST.EXE to find all properties for a specific AntiVirus or Firewall product.
💾 SecStat.kix Display a SecurityCenter status overview 2010-01-18 Requires Windows XP SP2 or SP3.
Use WBEMTEST.EXE to find all properties for a specific AntiVirus or Firewall product.
💾 SecStat.vbs Display a SecurityCenter status overview 2009-09-29 Requires Windows XP SP2 or SP3.
Use WBEMTEST.EXE to find all properties for a specific AntiVirus or Firewall product.
💾 Services.kix Display all services 2002-11-26  
💾 Services.vbs Display all services 2002-11-02  
💾 ServicesTD.vbs Display all services in TAB delimited format 2002-11-02  
💾 ShareMg2.vbs Migrate all non-printer shares from one server to another 2005-11-02 Currently for Windows Server 2003, created migration script needs manual modifications afterwards for Windows 2000.
(For printer migration, read the Printing section of my Unattended Installations page, for Scheduled Tasks migration, read the Scheduled Tasks section).
💾 ShowCpuH.ps1 Display CPU type, clock speed & load information in HTML 2006-09-01  
💾 ShowPRN.ps1 Display all installed printers and their properties 2006-09-10  
💾 ShowPRN.vbs Display all installed printers and their properties 2004-01-13  
💾 ShowPRNH.ps1 Display all installed printers and their properties in HTML 2006-08-31  
💾 ShowPRNT.vbs Display all installed printers and their properties in TAB delimited format 2004-01-17  
💾 Shutdown.vbs Shut down any WMI enabled computer on the network 2007-11-21 Based on a post by Alex K. Angelopoulos on Developersdex.com.
See my Shutdown page for shutdown and reboot commands for "all" operating systems.
💾 SID2User.bat Return the SID for the specified user ID 2010-07-26 Uses WMIC.
💾   Software.hta List installed software 2013-12-17 Automatically checks for updates.
💾 SrvInv.vbs Show and log a server hardware and software inventory 2005-09-14  
💾 Startup.vbs Display all startup commands (Startup folder and registry Run) 2003-01-16  
💾 TimeSyncWeb.vbs Synchronize your computer's system time with any webserver 2014-01-10  
💾 UpTime.vbs Display uptime for any WMI enabled computer 2006-04-22  
💾 User2SID.bat Return DOMAIN\UserID for the specified SID 2010-07-26 Uses WMIC.
💾 VBSNames.vbs Demonstrates several VBScript techniques to retrieve user names, computer names & domain names 2007-01-22 Demo script from my VBScript scripting techniques section.
💾 VideoROM.kix Display video adapter summary 2003-01-09  
💾 VideoROM.vbs Display video adapter summary 2002-12-01  
💾 WinSAT.bat Return the Windows System Assessment Tool's (WinSAT) scores for the specified computer 2013-11-20  
💾 WinVer.vbs Display the Windows version 2005-07-26  
💾 WMIAlias.bat Return the WMI class name for the specified WMIC alias, or list them all 2023-11-17 Uses WMIC.
💾   WMIGen.exe Generate Batch, C, C++, C#, Delphi, F#, Java, JScript, Lua, KiXtart, Object Pascal, Object Rexx, Perl, PHP, PowerShell, Python, Ruby, Tcl, VB .NET and VBScript code for WMI queries 2023-02-25 This compiled executable is the successor of the HTA version.
Based on the example from the Microsoft TechNet ScriptCenter article Scripting Eye for the GUI Guy.
💾   WMIGen.hta This HTA generates Batch, C#, F#, Java, JScript, KiXtart, Object Rexx, Perl, PowerShell, Python, Ruby, VB .NET and VBScript code for WMI queries 2016-01-28 Discontinued. Use the compiled executable instead.

page last modified: 2024-03-21; loaded in 0.3310 seconds