Skip to main content

Get TPM Status

Summary

Fetches the TPM Status of the machine and stores it in the TPM Status custom field.

Sample Run

Sample Run 1

Sample Run 2

Dependencies

CW RMM - Custom Field - Endpoint - TPM Status
Create the dependent Custom Field before creating the task.

Task Creation

Create a new Script Editor style script in the system to implement this Task.

Task Creation Image 1

Task Creation Image 2

Name: Get TPM Status
Description: Fetches the TPM Status of the machine and stores it in the TPM Status custom field.
Category: Security

Task Creation Image 3

Task

Navigate to the Script Editor Section and start by adding a row. You can do this by clicking the Add Row button at the bottom of the script page.

Add Row

A blank function will appear.

Blank Function

Row 1 Function: PowerShell Script

Search and select the PowerShell Script function.

PowerShell Script Function

PowerShell Script Function Image 2

The following function will pop up on the screen:

PowerShell Script Popup

Paste in the following PowerShell script and set the Expected time of script execution in seconds to 300 seconds. Click the Save button.

try {
$tpmResults = Get-Tpm -ErrorAction Stop
} catch {
throw "The script did not return the expected result. Reason: $($Error[0].Exception.Message)"
}
return "TpmEnabled: $($tpmResults.TpmEnabled) | TpmActivated: $($tpmResults.TpmActivated) | TpmReady: $($tpmResults.TpmReady) | TpmPresent: $($tpmResults.TpmPresent) | RestartPending: $($tpmResults.RestartPending)"

PowerShell Script Execution Image

Row 2 Function: Script Log

Add a new row by clicking the Add Row button.

Add Row for Script Log

A blank function will appear.

Blank Function for Script Log

Search and select the Script Log function.

Script Log Function

Script Log Function Image 2

The following function will pop up on the screen:

Script Log Popup

In the script log message, simply type %output% and click the Save button.

Script Log Save

Row 3 Function: Set Custom Field

Add a new row by clicking the Add Row button.

Add Row for Set Custom Field

A blank function will appear.

Blank Function for Set Custom Field

Search and select the Set Custom Field function.

Set Custom Field Function

The following function will pop up on the screen:

Set Custom Field Popup

  • Search and select the Computer-Level Custom Field TPM Status from the Custom Field dropdown menu.
  • Set %Output% in the Value field.
  • Click the Save button.

Set Custom Field Save

Click the Save button at the top-right corner of the screen to save the script.

Save Script

Completed Script

Completed Script

Output

  • Script log
    Script Log Output

  • Custom Field
    Custom Field Output
    Example: TpmEnabled: True | TpmActivated: True | TpmReady: True | TpmPresent: True | RestartPending: False