Wolfram Research

WindowsSystemData

Contributed by: Richard Hennigan (Wolfram Research)

Source Notebook

Get information from the current Windows system about running processes, hardware, security settings, and more

ResourceFunction["WindowsSystemData"][alias]

returns a Dataset containing system information for alias.

ResourceFunction["WindowsSystemData"][alias,"property"]

returns a specific property.

ResourceFunction["WindowsSystemData"][alias,"property"value]

returns instances where "property" is equal to value.

ResourceFunction["WindowsSystemData"][alias,{propspec1,propspec2,}]

use multiple properties and/or rules.

Details and Options

ResourceFunction["WindowsSystemData"] is a read-only interface to the WMIC utility.
ResourceFunction["WindowsSystemData"]["Properties"] returns a list of possible aliases.
Some typical aliases, along with their canonical WMIC names are:
"BIOS" bios basic input/output services (BIOS) information
"BootConfiguration" bootconfig boot configuration information
"CacheMemory" memcache cache memory information
"CDROM" cdrom CD-ROM information
"ComputerSystem" computersystem computer system information
"CPU" cpu CPU information
"Desktop" desktop user's desktop information
"DesktopMonitor" desktopmonitor desktop monitor information
"Directory" fsdir filesystem directory entry information
"DiskDrive" diskdrive physical disk drive information
"DiskQuota" diskquota disk space usage for NTFS volumes
"Environment" environment system environment settings
"Group" group group account information
"HotfixInformation" qfe hotfix information (quick fix engineering)
"IDEController" idecontroller IDE controller information
"IRQ" irq interrupt request line (IRQ) information
"Job" job provides access to the jobs scheduled using the schedule service
"LoadOrder" loadorder information about system services that define execution dependencies
"LogicalDisk" logicaldisk logical storage device information
"Motherboard" baseboard motherboard (baseboard) information
"NetClient" netclient network client information
"NetLogin" netlogin network login information (of a particular user)
"NetProtocol" netprotocol protocols (and their network characteristics) information
"NetUse" netuse active network connection information
"NetworkInterfaceController" nic network interface controller (NIC) information
"NetworkInterfaceControllerConfiguration" nicconfig network adapter information
"NTDomain" ntdomain NT domain information
"NTEvent" ntevent entries in the NT event log
"OnboardDevice" onboarddevice information about devices built into the motherboard
"OperatingSystem" os installed operating system(s) information
"PageFile" pagefile virtual memory file swapping information
"PageFileSet" pagefileset page file settings information
"Partition" partition information about partitioned areas of a physical disk
"PhysicalMemory" memphysical computer system’s physical memory information
"Printer" printer printer device information
"PrintJob" printjob print job information
"Process" process process information
"Product" product installation package task information
"Properties" properties get a list of valid aliases
"QuotaSetting" quotasetting setting information for disk quotas on a volume
"Registry" registry computer system registry information
"SCSIController" scsicontroller SCSI controller information
"Server" server server information
"Service" service service application information
"Share" share shared resource information
"SoundDevice" sounddev sound device information
"StartUp" startup information about commands that run automatically at startup
"SystemAccount" sysaccount system account information
"SystemDriver" sysdriver information about the system driver for a base service
"SystemEnclosure" systemenclosure physical system enclosure information
"SystemRecoverySettings" recoveros information that will be gathered when the operating system fails
"SystemSlot" systemslot information about ports, slots, and peripherals
"TapeDrive" tapedrive tape drive information
"TimeZone" timezone time zone data information
"UserAccount" useraccount user account information

Examples

Basic Examples

Get information about the operating system:

In[1]:=
ResourceFunction["WindowsSystemData"]["OperatingSystem"]
Out[1]=

Get a specific set of properties of the CPU:

In[2]:=
ResourceFunction[
 "WindowsSystemData"]["CPU", {"Name", "CurrentClockSpeed", "LoadPercentage", "NumberOfLogicalProcessors", "L2CacheSize", "L3CacheSize"}]
Out[2]=

Get information about the current kernel process:

In[3]:=
ResourceFunction["WindowsSystemData"]["Process", "ProcessID" -> $ProcessID]
Out[3]=

Get a list of possible properties:

In[4]:=
ResourceFunction["WindowsSystemData"]["Properties"]
Out[4]=

Scope

Get values for system environment variables:

In[5]:=
ResourceFunction[
 "WindowsSystemData"]["Environment", {"Name", "VariableValue", "SystemVariable" -> True}]
Out[5]=

View properties about installed applications:

In[6]:=
Select[ResourceFunction["WindowsSystemData"][
  "Product"], #Vendor === "Wolfram Research, Inc." &]
Out[6]=

Get information about a directory:

In[7]:=
ResourceFunction["WindowsSystemData"]["DirectoryInformation", "Name" -> $InstallationDirectory]
Out[7]=

Check the status of device drivers:

In[8]:=
Select[ResourceFunction["WindowsSystemData"][
  "SystemDriver", {"Description", "State"}], StringContainsQ[#Description, "bluetooth", IgnoreCase -> True] &]
Out[8]=

Applications

Track how much data is written to disk during an evaluation:

In[9]:=
trackDiskWrites // Attributes = {HoldFirst};
trackDiskWrites[eval_] :=
  Module[{start, result, end},
   start = ResourceFunction["WindowsSystemData"][
     "Process", {"ProcessId" -> $ProcessID, "WriteTransferCount"}];
   result = eval;
   end = ResourceFunction["WindowsSystemData"][
     "Process", {"ProcessId" -> $ProcessID, "WriteTransferCount"}];
   {end - start, result}
   ];
In[10]:=
bytes = ByteArray[RandomInteger[255, 10^7]]
Out[10]=
In[11]:=
trackDiskWrites[Export[CreateFile[], bytes, "Binary"]]
Out[11]=
In[12]:=
DeleteFile[Last[%]]

Neat Examples

Create a dynamic status monitor that shows CPU and memory usage:

In[13]:=
max = ResourceFunction["WindowsSystemData"]["ComputerSystem", "TotalPhysicalMemory"];
CreatePalette[
 Panel[Grid[{{"CPU:", Dynamic[Refresh[
       ProgressIndicator[
        QuantityMagnitude[
         ResourceFunction["WindowsSystemData"]["CPU", "LoadPercentage"]], {0, 100}], UpdateInterval -> 5, TrackedSymbols :> {}]]},
    {"Memory:", Dynamic[Refresh[
       ProgressIndicator[
        ResourceFunction["WindowsSystemData"]["OS", "FreePhysicalMemory"]/max], UpdateInterval -> 5, TrackedSymbols :> {}]]}},
   Alignment -> {{Right, Left}, Automatic}]], WindowTitle -> "System Monitor"]
Out[14]=

Resource History

See Also