02-06-2023 10:52 PM - last edited on 06-27-2023 01:49 PM by ErikT
Currently no function is available to have lansweeper natively discover the serial numbers or any other information regarding Dell docking stations. My solution is a bit lengthy, but it got the results I needed.
TL:DR end result is a custom field titled "Docking Station" being filled with the serial number of the docking station plugged in to that computer that day.
1. You need to have "Dell Command Monitor" installed on dell laptops. It will do forced restart on silent install so the "norestart" is necessary since the data we need will be compiled without reboot.
This is the deployment I set up for that:
<Name>32Dell Command Monitor</Name>
<Description></Description>
<ShutdownOption>0</ShutdownOption>
<ShutdownTime>0</ShutdownTime>
<MaxDuration>900</MaxDuration>
<Rescan>True</Rescan>
<RunMode>2</RunMode>
<Steps>
<Step>
<Nr>1</Nr>
<Name>Install</Name>
<Type>1</Type>
<ReturnCodes>0,1641,3010</ReturnCodes>
<Success>-1</Success>
<Failure>-3</Failure>
<Path>{PackageShare}\</Path>
<Parameters></Parameters>
<MSIParameters>/i /qn /norestart</MSIParameters>
<MSIName></MSIName>
<MSIVersion></MSIVersion>
<Command>msiexec.exe /q /i "{PackageShare}\Installers\Dell\Command_Monitor_x64.msi" /norestart</Command>
<EditMode>True</EditMode>
<Conditions />
</Step>
<Step>
<Nr>2</Nr>
<Name>Registry Script</Name>
<Type>2</Type>
<ReturnCodes>0,1641,3010</ReturnCodes>
<Success>-2</Success>
<Failure>-3</Failure>
<Path></Path>
<Parameters></Parameters>
<MSIParameters></MSIParameters>
<MSIName></MSIName>
<MSIVersion></MSIVersion>
<Command>powershell.exe -executionpolicy unrestricted -file "{PackageShare}\Scripts\DockRegistry.ps1"</Command>
<EditMode>False</EditMode>
<Conditions />
</Step>
</Steps>
<SoftwareVersion>10.3.2.0</SoftwareVersion>
</Package>
2. The powershell script that I have running on the second step calls the new information that is now available through the install of command monitor, and creates a registry key with the relevant data. Computer Name, Current User, Dock Service Tag.
DockRegistry.ps1:
$output = Get-CimInstance -Namespace root\dcim\sysman -ClassName DCIM_Chassis | Where-Object {$_.Name -eq "WD19TB"} | select Tag,Name | ForEach-Object {
$computer = $_.Name
$computerInfo = Get-WmiObject -Class Win32_ComputerSystem
$userInfo = Get-WmiObject -Class Win32_ComputerSystem | Select-Object UserName
[PSCustomObject]@{
'ComputerName' = $computerInfo.Name
'User' = $userInfo.UserName
'Tag' = $_.Tag
}
}
$output | ForEach-Object {
New-Item -Path "HKLM:\Software\ReportValues" | Out-Null
New-ItemProperty -Path "HKLM:\Software\ReportValues" -Name "ComputerName" -Value $_.ComputerName -PropertyType String -Force
New-ItemProperty -Path "HKLM:\Software\ReportValues" -Name "User" -Value $_.User -PropertyType String -Force
New-ItemProperty -Path "HKLM:\Software\ReportValues" -Name "DockST" -Value $_.Tag -PropertyType String -Force
}
3. I then created a registry scan for the "Report Values\DockST" so that I get the service tag of the dock as a value in the lansweeper database.
(The next part is messing with the lansweeper DB which is frowned upon by the devs. So always backup before doing anything even if it's this basic.)
4. This only works if you have the lansweeper DB on a true SQL instance since you need to run a script against the DB.
This script takes the result from the Registry scan and plugs it in to first Custom field for an asset if it has an entry.
UPDATE dbo.tblAssetCustom
SET dbo.tblAssetCustom.Custom1 = dbo.tblRegistry.value
FROM dbo.tblAssetCustom INNER JOIN dbo.tblRegistry
ON dbo.tblAssetCustom.AssetID = dbo.tblRegistry.AssetID
WHERE tblRegistry.Regkey LIKE '%ReportValues%'
When I confirmed it worked I just changed the display name for the field to "Dock Service Tag".
Now that all of this is put together, and you know where to find everything. One thing that can be done is to attach the powershell script to the event 9002 which is the event for when a thunderbolt device is attached. Then set the db copy job to go off after scans.
08-30-2024 05:53 PM
Second this. I find it wild that we get charged for assets that can't natively be scanned when we put them into Lansweeper for asset management purposes, but Lansweeper can't actually scan for those items.
04-03-2024 05:41 AM - edited 04-03-2024 05:42 AM
Dell Docking station scanning should absolutely be included natively in LanSweeper. Maybe LS should follow this guy's lead. Any update in the last 14 months since he posted this? How can we use LanSweeper for our asset management if it can't manage all our assets, and docking stations are an important part of that. I'd like it to include not only Docking Station serial & model numbers, but also its firmware revision, and both its NIC & Audio driver versions in the asset info.
4 weeks ago
I totally agree. This should be a very simple thing to add. It would not only help the customer tremendously, but would increase the number of assets that Lansweeper can charge for, so it's a win for the customer (and a loss as well, but we can choose whether or not to track them) and a win for LS.
It would be a wonderful addition if they could also add a built in report of when the dock is connected/disconnected (we have lots of laptops in our environment that haven't been disconnected from their dock in 3 years, so we can use that information to replace them with desktops during the next refresh cycle, and reduce our hardware costs)
02-07-2023 02:02 PM
Hello there!
That's an impressive workaround, indeed. Before running custom database scripts on your database, we do highly recommend taking a backup first: https://community.lansweeper.com/t5/lansweeper-maintenance/back-up-your-installation/ta-p/64309
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now