SMBStuff plugin for Take Command / TCC / TCC/LE

beta version 0.26.3.1     2023-10-12

Charles Dye

Purpose:

This plugin provides a way to retrieve system information via SMBIOS. It requires Windows Vista or later; it will not work with earlier versions of Windows.

Installation:

To use this plugin, copy SMBStuff.dll to some known location on your hard drive. (If you are still using the 32-bit version of Take Command, take SMBStuff-x86.dll instead of SMBStuff.dll.) Load the plugin with a PLUGIN /L command, for example:

plugin /l c:\bin\tcmd\test\smbstuff.dll

If you copy this file to a subdirectory named PlugIns within your Take Command program directory, the plugin will be loaded automatically when TCC starts.

Plugin Features:

New variables: _SMBASSETTAG, _SMBBBASSETTAG, _SMBBBMFG, _SMBBBPRODUCT, _SMBBBSERIAL, _SMBBBVERSION, _SMBBIOSDATE, _SMBBIOSREV, _SMBBIOSVENDOR, _SMBBIOSVERSION, _SMBBOX, _SMBCHASSIS, _SMBCHASSISLOCK, _SMBCHASSISTAG, _SMBCHASSISTYPE, _SMBCPUCLOCK, _SMBCPUMFG, _SMBCPUSOCKET, _SMBCPUSPEED, _SMBCPUVERSION, _SMBFAMILY, _SMBMFG, _SMBPRODUCT, _SMBSERIAL, _SMBVER

New functions: @RANDX, @SMBBYTE, @SMBDWORD, @SMBQWORD, @SMBSTRING, @SMBWORD

Syntax Note:

The syntax definitions in the following text use these conventions for clarity:

BOLD CODEindicates text which must be typed exactly as shown.
CODEindicates optional text, which may be typed as shown or omitted.
Bold italicnames a required argument; a value must be supplied.
Regular italicnames an optional argument.
ellipsis…after an argument means that more than one may be given.

New Variables:

_SMBASSETTAG — Returns the system asset tag string.

Syntax:
%_SMBASSETTAG

This variable combines _SMBCHASSISTAG and _SMBBBASSETTAG. It tries that chassis asset tag string first. If it can’t find that, it tries the baseboard asset tag. If neither one is found, _SMBASSETTAG returns N/A.

iff "%_smbassettag" ne "n/a" then
   echo Asset tag: %_smbassettag
else
   echo Asset tag not available
endiff



_SMBBBASSETTAG — Returns the baseboard asset tag string.

Syntax:
%_SMBBBASSETTAG

If this string is not present, _SMBBBASSETTAG returns N/A.

iff "%_smbbbassettag" ne "n/a" then
   echo Baseboard asset tag: %_smbbbassettag
else
   echo Baseboard asset tag not available
endiff



_SMBBBMFG — Returns the baseboard manufacturer string.

Syntax:
%_SMBBBMFG

If this string is not present, _SMBBBMFG returns N/A.

iff "%_smbbbmfg" ne "n/a" then
   echo Baseboard manufacturer: %_smbbbmfg
else
   echo Baseboard manufacturer not available
endiff



_SMBBBPRODUCT — Returns the baseboard product name string.

Syntax:
%_SMBBBPRODUCT

If this string is not present, _SMBBBPRODUCT returns N/A.

iff "%_smbbbproduct" ne "n/a" then
   echo Baseboard product name: %_smbbbproduct
else
   echo Baseboard product name not available
endiff



_SMBBBSERIAL — Returns the baseboard serial number string.

Syntax:
%_SMBBBSERIAL

The baseboard serial number is not necessarily the same as the computer’s serial number. If this string is not present, _SMBBBSERIAL returns N/A.

iff "%_smbbbserial" ne "n/a" then
   echo Baseboard serial number: %_smbbbserial
else
   echo Baseboard serial number not available
endiff



_SMBBBVERSION — Returns the baseboard version string.

Syntax:
%_SMBBBVERSION

If this string is not present, _SMBBBVERSION returns N/A.

iff "%_smbbbversion" ne "n/a" then
   echo Baseboard version: %_smbbbversion
else
   echo Baseboard version not available
endiff



_SMBBIOSDATE — Returns the BIOS date string.

Syntax:
%_SMBBIOSDATE

The date string should be either MM/DD/YYYY or MM/DD/YY; for the latter, assume the 1900s. If this string is not present, _SMBBIOSDATE returns N/A.

iff "%_smbbiosdate" ne "n/a" then
   echo BIOS date: %_smbbiosdate
else
   echo BIOS date string not available
endiff



_SMBBIOSREV — Returns the BIOS revision level.

Syntax:
%_SMBBIOSREV

The BIOS revision will be returned as x.y, where x is the major part and y is the minor. If this value is not present, _SMBBIOSREV returns N/A.

iff "%_smbbiosrev" ne "n/a" then
   echo BIOS revision: %_smbbiosrev
else
   echo BIOS revision not available
endiff



_SMBBIOSVENDOR — Returns the BIOS vendor string.

Syntax:
%_SMBBIOSVENDOR

If this string is not present, _SMBBIOSVENDOR returns N/A.

iff "%_smbbiosvendor" ne "n/a" then
   echo BIOS vendor: %_smbbiosvendor
else
   echo BIOS vendor string not available
endiff



_SMBBIOSVERSION — Returns the BIOS version string.

Syntax:
%_SMBBIOSVERSION

If this string is not present, _SMBBIOSVERSION returns N/A.

iff "%_smbbiosversion" ne "n/a" then
   echo BIOS version: %_smbbiosversion
else
   echo BIOS version string not available
endiff



_SMBBOX — Returns a one-letter code for the chassis type.

Syntax:
%_SMBBOX

If SMBIOS reports a chassis type of ‘Portable’, ‘LapTop’, ‘Notebook’, ‘Hand Held’, or ‘Sub Notebook’, _SMBBOX returns the letter L. Otherwise, it returns D. Note that there is no error return; if the function fails for any reason, _SMBBOX returns a D.

iff "%_smbbox" == "L" then
   echo Laptop or portable computer
else
   echo Not a laptop or portable
endiff



_SMBCHASSIS — Returns the system chassis type byte.

Syntax:
%_SMBCHASSIS

If this information is not present, _SMBCHASSIS returns N/A.

iff "%_smbchassis" ne "n/a" then
   echo Chassis type: %_smbchassis
else
   echo Chassis type byte not available
endiff



_SMBCHASSISLOCK — Returns whether a chassis lock is present.

Syntax:
%_SMBCHASSISLOCK

This variable returns Present, Not present, or N/A if chassis lock information is not available.

iff "%_smbchassislock" ne "n/a" then
   echo Chassis lock: %_smbchassislock
else
   echo Chassis lock information not available
endiff



_SMBCHASSISTAG — Returns the chassis asset tag string.

Syntax:
%_SMBCHASSISTAG

If this string is not present, _SMBCHASSISTAG returns N/A.

iff "%_smbchassistag" ne "n/a" then
   echo Chassis asset tag: %_smbchassistag
else
   echo Chassis asset tag not available
endiff



_SMBCHASSISTYPE — Returns a string description of the chassis type.

Syntax:
%_SMBCHASSISTYPE

Possible return values include:

If this information is not present, _SMBCHASSISTYPE returns N/A.



_SMBCPUCLOCK — Returns the processor’s external clock speed in MHz.

Syntax:
%_SMBCPUCLOCK

If this information is not present, _SMBCPUCLOCK returns N/A.

iff "%_smbcpuclock" ne "n/a" then
   echo External CPU clock speed: %_smbcpuclock MHz
else
   echo External CPU clock speed not available
endiff



_SMBCPUMFG — Returns the processor’s manufacturer string.

Syntax:
%_SMBCPUMFG

If this string is not present, _SMBCPUMFG returns N/A.

iff "%_smbcpumfg" ne "n/a" then
   echo Processor manufacturer: %_smbcpumfg
else
   echo Processor manufacturer string not available
endiff



_SMBCPUSOCKET — Returns a string describing the processor socket.

Syntax:
%_SMBCPUSOCKET

If this string is not present, _SMBCPUSOCKET returns N/A.

iff "%_smbcpusocket" ne "n/a" then
   echo Processor socket: %_smbcpusocket
else
   echo Processor socket string not available
endiff



_SMBCPUSPEED — Returns the processor speed at boot time, in MHz.

Syntax:
%_SMBCPUSPEED

If this information is not present, _SMBCPUSPEED returns N/A.

iff "%_smbcpuspeed" ne "n/a" then
   echo Processor speed: %_smbcpuspeed MHz
else
   echo Processor speed not available
endiff



_SMBCPUVERSION — Returns a string describing the processor version.

Syntax:
%_SMBCPUVERSION

If this string is not present, _SMBCPUVERSION returns N/A.

iff "%_smbcpuversion" ne "n/a" then
   echo Processor version: %_smbcpuversion
else
   echo Processor version string not available
endiff



_SMBMFG — Returns the system manufacturer string.

Syntax:
%_SMBMFG

If this string is not present, _SMBMFG returns N/A.

iff "%_smbmfg" ne "n/a" then
   echo Manufacturer: %_smbmfg
else
   echo Manufacturer string not available
endiff



_SMBPRODUCT — Returns the system product name string.

Syntax:
%_SMBPRODUCT

If this string is not present, _SMBPRODUCT returns N/A.

iff "%_smbproduct" ne "n/a" then
   echo Product name: %_smbproduct
else
   echo Product name string not available
endiff



_SMBSERIAL — Returns the system serial number string.

Syntax:
%_SMBSERIAL

On Dell computers, this string generally matches the ‘service tag’. If this string is not present, _SMBSERIAL returns N/A.

iff "%_smbserial" ne "n/a" then
   echo Serial number: %_smbproduct
else
   echo Serial number string not available
endiff



_SMBVER — Returns the SMBIOS version number.

The version will be returned as x.y, where x is the major part and y is the minor. If this value is not present, _SMBVER returns N/A.

iff "%_smbver" ne "n/a" then
   echo SMBIOS version: %_smbver
else
   echo SMBIOS version not available
endiff



New Functions:

@RANDX — Returns a string of random hex digits.

Syntax:
%@RANDX[n]

nthe number of digits; defaults to 8

This function has nothing to do with SMBIOS. It’s provided as fallback means of generating ‘serial numbers’ if all else fails.

echo %@randx[5]



@SMBBYTE — Returns a byte value from an SMBIOS structure.

Syntax:
%@SMBBYTE[type,offset,handle,flags]

typethe SMBIOS type number of the structure to find; 0 to 255
offsetthe offset of the byte within the fixed data area; 4 to 255
handlethe handle of the structure to find; optional, 0 to 0xffff
flags1 to return the value as hexadecimal

If a matching structure cannot be found, or if the specified offset is not within the fixed data area, this function returns N/A.



@SMBDWORD — Returns a double-word value from an SMBIOS structure.

Syntax:
%@SMBDWORD[type,offset,handle,flags]

typethe SMBIOS type number of the structure to find; 0 to 255
offsetthe (byte) offset of the word within the fixed data area; 4 to 252
handlethe handle of the structure to find; optional, 0 to 0xffff
flags1 to return the value as hexadecimal

If a matching structure cannot be found, or if the specified offset is not within the fixed data area, this function returns N/A.



@SMBQWORD — Returns a quad-word value from an SMBIOS structure.

Syntax:
%@SMBQWORD[type,offset,handle,flags]

typethe SMBIOS type number of the structure to find; 0 to 255
offsetthe (byte) offset of the word within the fixed data area; 4 to 248
handlethe handle of the structure to find; optional, 0 to 0xffff
flags1 to return the value as hexadecimal

If a matching structure cannot be found, or if the specified offset is not within the fixed data area, this function returns N/A.



@SMBSTRING — Returns a string value from an SMBIOS structure.

Syntax:
%@SMBSTRING[type,offset,handle]

typethe SMBIOS type number of the structure to find; 0 to 255
offsetthe (byte) offset of the word within the fixed data area; 4 to 248
handlethe handle of the structure to find; optional, 0 to 0xffff

This function returns N/A on any error.



@SMBWORD — Returns a quad-word value from an SMBIOS structure.

Syntax:
%@SMBWORD[type,offset,handle,flags]

typethe SMBIOS type number of the structure to find; 0 to 255
offsetthe (byte) offset of the word within the fixed data area; 4 to 254
handlethe handle of the structure to find; optional, 0 to 0xffff
flags1 to return the value as hexadecimal

If a matching structure cannot be found, or if the specified offset is not within the fixed data area, this function returns N/A.



Startup Message:

This plugin displays an informational line when it initializes. The message will be suppressed in transient or pipe shells. You can disable it for all shells by defining an environment variable named NOLOADMSG, for example:

set /e /u noloadmsg=1

Status and Licensing:

Consider this beta software. It may well have issues. Try it at your own risk. If you find a problem, you can report it in the JP Software support forum.

SMBStuff is currently licensed only for testing purposes. I may make binaries and source code available under some free license once I consider it ready for use.

Download:

You can download the current version of the plugin from http://charlesdye.net/dl/smbstuff.zip.