-
Notifications
You must be signed in to change notification settings - Fork 0
/
SCCM - Check Device TPM Status.ps1
74 lines (51 loc) · 2.08 KB
/
SCCM - Check Device TPM Status.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
Import-Module ActiveDirectory
$CSVFile = "C:\ContosoTemp\CDW Results3.csv"
$Domain = "Contoso"
# ---------------------------------------------------------------------
# Import SCCM Site
# ---------------------------------------------------------------------
# Site configuration
$SiteCode = "CM1" # Site code
$ProviderMachineName = "sccm.contoso.com" # SMS Provider machine name
# Customizations
$initParams = @{}
# Do not change anything below this line
# Import the ConfigurationManager.psd1 module
if ((Get-Module ConfigurationManager) -eq $null)
{
Import-Module "$($ENV:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1" @initParams
}
# Connect to the site's drive if it is not already present
if ((Get-PSDrive -Name $SiteCode -PSProvider CMSite -ErrorAction SilentlyContinue) -eq $null)
{
New-PSDrive -Name $SiteCode -PSProvider CMSite -Root $ProviderMachineName @initParams
}
# Set the current location to be the site code.
Set-Location "$($SiteCode):\" @initParams
# ---------------------------------------------------------------------
$List = Import-CSV -Path $CSVFile
# Get all BIOS Information
$WMI = Get-WmiObject -Namespace "root\sms\site_$($SiteCode)" -Class SMS_G_System_PC_BIOS -ComputerName $ProviderMachineName
$NewCSV = ForEach ($Entry in $List)
{
#Read the CSV In
$ComputerName = $Entry.'Machine Name'
$Mfg = $Entry.Manufacturer
$ModelWMI = $Entry.Model
$TPMVersion = $Entry.'TPM Version'
$TPMActivated = $Entry.'TPM Activated'
$TPMEnabled = $Entry.'TPM Enabled'
# Query SCCM for Information
$Device = Get-CMDevice -Name $ComputerName -Fast
$ResourceID = $Device.ResourceID
$BiosRow = $WMI | Where-Object {$_.ResourceID -eq $ResourceID}
# Write out BIOS
$Entry.BIOSVersion = $BiosRow.SMBIOSBIOSVersion
# Write OS
$Entry.OS = $Device.DeviceOS
# Write out to new CSV
$Entry
}
#$NewCSV | Out-GridView
$NewCSV | Export-CSV C:\ContosoTemp\TMP.csv -NoTypeInformation