Skip to content

Instantly share code, notes, and snippets.

@jazzbanzai
Created February 20, 2022 10:49
Show Gist options
  • Save jazzbanzai/36f81008429724134b2a39fe72b3e521 to your computer and use it in GitHub Desktop.
Save jazzbanzai/36f81008429724134b2a39fe72b3e521 to your computer and use it in GitHub Desktop.
#REF1: https://www.dell.com/support/kbdoc/en-in/000126566/windows-how-to-identify-your-dell-docking-station-using-powershell
Set-Location -Path C:\temp
$dellcabURL = 'https://downloads.dell.com/catalog/DellSDPCatalogPC.cab'
$fileName = $dellcabURL.Substring($dellcabURL.LastIndexOf('/') + 1)
#Download Dell Cab
Invoke-WebRequest -URI $dellcabURL -UseBasicParsing -OutFile "c:\temp\$fileName"
#Extact DellSDPCatalogPC.xml
& extrac32.exe "c:\temp\$fileName" DellSDPCatalogPC.xml /Y
#find the line (would be beettr ro pharse the XML)
$MSIregex = 'https:\/\/.*DSIA.*.msi'
$DellMSI = Get-Content -Path "c:\temp\DellSDPCatalogPC.xml" | Select-String -pattern $MSIregex | foreach {$_.Matches.Value}
#Download install the Dell-MSI (dell client system inventory agent)
$fileName = $DellMSI.Substring($DellMSI.LastIndexOf('/') + 1)
Invoke-WebRequest -Uri $DellMSI -UseBasicParsing -OutFile "c:\temp\$fileName"
Start-Process msiexec.exe -Wait -ArgumentList "/i `"C:\temp\$fileName`" /qn /l*v `"C:\temp\$fileName.log`" "
#get inventory +dock
gwmi -n root\dell\sysinv dell_softwareidentity | select * | where elementname -like "*WD*"
@jazzbanzai
Copy link
Author

jazzbanzai commented Nov 29, 2022

Was just posted here for this reddit thread:
https://www.reddit.com/r/Dell/comments/glmgge/tip_how_to_get_a_docking_station_serial_number/

I'm sure there are definitely better ways to-do it. (Including correcting all my spelling mistakes)

PS. If its a new'er' dock - like the WD19 - can use the Firmware tool to scrape the Serial Number info.

@jboznw
Copy link

jboznw commented Nov 30, 2022 via email

@NOLA-CML
Copy link

NOLA-CML commented Mar 7, 2023

I know this is a tad old, just came across this and modified it for our use, figured I'd share.

#REF1: https://www.dell.com/support/kbdoc/en-in/000126566/windows-how-to-identify-your-dell-docking-station-using-powershell
$path = "$env:temp"
Set-Location -Path $path
$dellcabURL = 'https://downloads.dell.com/catalog/DellSDPCatalogPC.cab'
$fileName = "$path\$($dellcabURL.Substring($dellcabURL.LastIndexOf('/') + 1))"

#Download Dell Cab
(New-Object net.webclient).Downloadfile($dellcabURL, $fileName) #I find this is faster than Invoke-WebRequest

#Extact DellSDPCatalogPC.xml
Start-Process extrac32.exe -Wait -ArgumentList "$fileName DellSDPCatalogPC.xml /Y"

#find the line (would be beettr ro pharse the XML)
$MSIregex = 'https:\/\/.*DSIA.*.msi' 
$DellMSI = Get-Content -Path "$path\DellSDPCatalogPC.xml" | Select-String -pattern $MSIregex | foreach {$_.Matches.Value}

#Install the Dell-MSI (dell client system inventory agent)
Start-Process msiexec.exe -Wait -ArgumentList "/i $DellMSI /qn /l*v `"$path\DSIA.log`" " #MSIs can be installed via url

do{
	$error.clear
	try{
		#get inventory +dock
		Get-CimInstance -Namespace root\dell\sysinv -ClassName dell_softwareidentity -ErrorAction Stop | select ElementName,SerialNumber | where elementname -like "*WD*"
	}
	catch{
		Write-Output "CimInstance not ready"
		Start-Sleep -Seconds 5
	}
} while ($error) #found that it would take time for the namespace to be available.

@Andrew-J-Larson
Copy link

Code for searching the XML instead of using REGEX on the URL (though it is a bit slower):

$RegexDSIA = '^Dell (OpenManage|(Client )?System) Inventory Agent.*$'
[xml]$DellCatalogXML = Get-Content -Path "c:\temp\DellSDPCatalogPC.xml"
$SoftwarePackageDSIA = @(
  $DellCatalogXML.SystemsManagementCatalog.SoftwareDistributionPackage | Where-Object {
    $_.LocalizedProperties.Title -match $RegexDSIA
  }
)[0]
$DellMSI = $DATA_SPD_DSIAPC.InstallableItem.OriginFile.OriginUri

Also crafted a script that could be modified to work with Intune: https://github.com/Andrew-J-Larson/OS-Scripts/blob/main/Windows/Dell/DSIA-Get-Docks-Example.ps1

@jazzbanzai
Copy link
Author

Code for searching the XML instead of using REGEX on the URL (though it is a bit slower):

$RegexDSIA = '^Dell (OpenManage|(Client )?System) Inventory Agent.*$'
[xml]$DellCatalogXML = Get-Content -Path "c:\temp\DellSDPCatalogPC.xml"
$SoftwarePackageDSIA = @(
  $DellCatalogXML.SystemsManagementCatalog.SoftwareDistributionPackage | Where-Object {
    $_.LocalizedProperties.Title -match $RegexDSIA
  }
)[0]
$DellMSI = $DATA_SPD_DSIAPC.InstallableItem.OriginFile.OriginUri

Also crafted a script that could be modified to work with Intune: https://github.com/Andrew-J-Larson/OS-Scripts/blob/main/Windows/Dell/DSIA-Get-Docks-Example.ps1

Great work! hopefully it will be helpful to all in the future.

@sahps
Copy link

sahps commented Dec 16, 2024

Note that if the device that is using the Dock isn't Dell, the MSI package refuses to install. (We have MS Surface using Dell docks)

@Andrew-J-Larson
Copy link

Note that if the device that is using the Dock isn't Dell, the MSI package refuses to install. (We have MS Surface using Dell docks)

Well, this would make sense, given that the class required to access the dock information would be reaching into Dell platform specific hooks. Something the surfaces wouldn't have, as not having been manufactured by Dell...

For it to work on non-Dell devices, it would probably require more requirements not already installed, likely Dell bloatware to some capacity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment