Microsoft Authenticator
A Microsoft app for iOS and Android devices that enables authentication with two-factor verification, phone sign-in, and code generation.
6,608 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am trying to create a Class to fetch some information from Hardware Inventory Report in Configuration manager. The .mof file is giving compile error. This script is copied from url - http://www.potentengineer.com/inventorying-and-reporting-on-driver-information-with-configmgr/
$NewClassName = 'Win32_PnpSignedDriver_Custom'
$Date = get-date
Remove-WmiObject $NewClassName -ErrorAction SilentlyContinue
$newClass = New-Object System.Management.ManagementClass ("root\cimv2", [String]::Empty, $null)
$newClass["__CLASS"] = $NewClassName
$newClass.Qualifiers.Add("Static", $true)
$newClass.Properties.Add("DeviceClass", [System.Management.CimType]::String, $false)
$newClass.Properties.Add("DeviceName", [System.Management.CimType]::String, $false)
$newClass.Properties.Add("DriverDate", [System.Management.CimType]::DateTime, $false)
$newClass.Properties.Add("DriverProviderName", [System.Management.CimType]::String, $false)
$newClass.Properties.Add("DriverVersion", [System.Management.CimType]::String, $false)
$newClass.Properties.Add("HardwareID", [System.Management.CimType]::String, $false)
$newClass.Properties.Add("DeviceID", [System.Management.CimType]::String, $false)
$newClass.Properties.Add("ScriptLastRan", [System.Management.CimType]::String, $false)
$newClass.Properties["DeviceName"].Qualifiers.Add("Key", $true)
$newClass.Properties["DeviceID"].Qualifiers.Add("Key", $true)
$newClass.Put() | Out-Null
Get-WmiObject win32_pnpsigneddriver -Property DeviceClass, DeviceName,DriverDate,DriverProviderName,DriverVersion,HardwareID,DeviceID |
where{$_.DeviceClass -ne 'VOLUMESNAPSHOT' -and $_.DeviceClass -ne 'LEGACYDRIVER' -and $_.DriverProviderName -ne 'Microsoft' -and $_.DriverVersion -notlike "2:5*"} |
ForEach-Object {
Set-WmiInstance -Namespace root\cimv2 -class $NewClassName -argument @{
DeviceClass = $_.DeviceClass;
DeviceName = $_.DeviceName;
DriverDate = $_.DriverDate;
DriverProviderName = $_.DriverProviderName;
DriverVersion = $_.DriverVersion;
HardwareID = $_.HardwareID;
DeviceID = $_.DeviceID;
ScriptLastRan = $Date
} | Out-Null
}
write-output "Complete"