Public/Dell.DCU/Public/Get-DellDeviceDetails.ps1
|
function Get-DellDeviceDetails { [CmdletBinding()] param ( [Parameter(Mandatory=$False)] [ValidateLength(4,4)] [string]$SystemSKUNumber, [string]$ModelLike ) $Manufacturer = (Get-CimInstance -ClassName Win32_ComputerSystem).Manufacturer if ((!($SystemSKUNumber)) -and (!($ModelLike))) { if ($Manufacturer -notmatch "Dell"){return "This Function is only for Dell Systems, or please provide a SKU"} $SystemSKUNumber = (Get-CimInstance -ClassName Win32_ComputerSystem).SystemSKUNumber } <# if (!($ModelLike)){ $DellSKU = Get-DellSupportedModels | Where-Object {$_.systemID -match $SystemSKUNumber} | Select-Object -First 1 } else { $DellSKU = Get-DellSupportedModels | Where-Object { $_.Model -match $ModelLike} } return $DellSKU | Select-Object -Property SystemID,Model #> $MoreData = Get-DellDriverPackXML if (!($ModelLike)){ $DrillDown = $MoreData.DriverPackManifest.DriverPackage.SupportedSystems.brand.model | Where-Object {$_.systemid -eq $SystemSKUNumber} | Select-Object -First 1 $RDSDate = [DATETIME]"$($DrillDown.rtsDate)" $DeviceOutput = New-Object -TypeName PSObject $DeviceOutput | Add-Member -MemberType NoteProperty -Name "SystemID" -Value "$($DrillDown.systemID)" -Force $DeviceOutput | Add-Member -MemberType NoteProperty -Name "Model" -Value "$($DrillDown.name)" -Force $DeviceOutput | Add-Member -MemberType NoteProperty -Name "RTSDate" -Value $([DATETIME]$RDSDate) -Force return $DeviceOutput } else{ $DrillDown = $MoreData.DriverPackManifest.DriverPackage.SupportedSystems.brand.model | Where-Object {$_.name -match $ModelLike} if ($DrillDown.count -gt 1){ $SystemIDs = $DrillDown.systemID | Select-Object -Unique $DeviceOutputObject = @() foreach ($SystemID in $SystemIDs){ $DrillDown = $MoreData.DriverPackManifest.DriverPackage.SupportedSystems.brand.model | Where-Object {$_.systemid -eq $SystemID}| Select-Object -First 1 $RDSDate = [DATETIME]"$($DrillDown.rtsDate)" $DeviceOutput = New-Object -TypeName PSObject $DeviceOutput | Add-Member -MemberType NoteProperty -Name "SystemID" -Value "$($DrillDown.systemID)" -Force $DeviceOutput | Add-Member -MemberType NoteProperty -Name "Model" -Value "$($DrillDown.name)" -Force $DeviceOutput | Add-Member -MemberType NoteProperty -Name "RTSDate" -Value $([DATETIME]$RDSDate) -Force $DeviceOutputObject += $DeviceOutput } return $DeviceOutputObject | Sort-Object -Property RTSDate } } } |