locked
TPM Version of remote computer via PowerShell help.... RRS feed

  • Question

  • I am attempting to get the TPM version of remote systems via PowerShell and having it export to excel.  Whether or not I have it export to excel it does not display any information, however the script does not return any errors stating issues with the script.

    Can someone please help me out?

     Set-ExecutionPolicy bypass -force

     Get-Content C:\Temp\OU_PC_Inventory_List.txt | ForEach {

        $computerName = $_

        $ErrorActionPreference = "SilentlyContinue"

        $props = @{

            ComputerName = $computerName
            IsActivated_InitialValue = ''
            IsEnabled_InitialValue = ''
            SpecVersion = ''
            Online = $false

            }

             If (Test-Connection -ComputerName $computerName -Count 1 -Quiet) {
             
             $props.Online = $true
             
             $TPM = Get-OSCTPMChip -ComputerName $computerName

             $props.ComputerName = $TPM.ComputerName
             $props.IsActivated_InitialValue = $TPM.IsActivated_InitialValue
             $props.IsEnabled_InitialValue = $TPM.IsEnabled_InitialValue
             $props.SpecVersion = $TPM.SpecVersion
             
         }

        New-Object PsObject -Property $props
        } | Sort ComputerName |
             Select ComputerName, IsActivated_InitialValue, IsEnabled_InitialValue,SpecVersion |
                Export-Csv C:\Temp\TPM_Information.csv -NoTypeInformation


    Friday, April 13, 2018 11:32 AM

All replies

  • Please format and post you code correctly using the code posting tool provided.  Edit the original message to fix this. 


    \_(ツ)_/

    Friday, April 13, 2018 3:27 PM
  • What does it say without this?


       $ErrorActionPreference = "SilentlyContinue"


    • Edited by JS2010 Friday, April 13, 2018 6:33 PM
    Friday, April 13, 2018 6:32 PM