To clarify the IMEI section Surface imei's start with 355 so you would just need to change this to the first few numbers of your vender's imei.
you could also just set $imei to another system var or an arbitrary value too.
I have this deployed now, I ended up using PS2EXE and NSSM to turn the powershell script into an executable that runs as a service so it pings traccar every 60sec when the computer is not sleeping. It appears to be working well.
Nice one. How about using the serial number? $imei = wmic bios get serialnumber
??
I'm thinking that this could be done as a proactive remediation if you use intune. Similar to how Leanlaps is done: https://www.lieben.nu/liebensraum/2021/06/lightweight-laps-solution-for-intune-mde/
you want to use the serial as the ID or include it as a data point?
if you want it as a data point reported to Traccar
you would just add a temp var like $serialraw = Get-CIMInstance win32_bios | format-list SerialNumber
this would return the serial number but with some formatting and header. like this
SerialNumber : 123456
but we just want the number so we use .Remove to strip the prepended text.
so we create a final $serial
var and point it to $serial = $serialraw.Remove(0,16)
This will leave $serial
as just the number part stripping the preceding 16 char.
now you have a var that is the serial and you just need to send it.
this is the line that sends data to traccar.
$traccar = "http://*YOURSERVERHERE*:5055/?id="+($imei)+"&lat="+($latitude)+"&lon="+($longitude)+"×tamp="+($timestamp)+"&altitude="+($altitude)+"&speed="+($mph)+"&battery="+($bat)+"&accuracy="+($accu)
$traccar = "http://*YOURSERVERHERE*:5055/?id="+($imei)+"&lat="+($latitude)+"&lon="+($longitude)+"×tamp="+($timestamp)+"&altitude="+($altitude)+"&speed="+($mph)+"&battery="+($bat)+"&accuracy="+($accu)**+"&serial="+($serial)**
if you just want to use the serial as the ID can you could do the above variable part then just change the send line part from
http://*YOURSERVERHERE*:5055/?id="+($imei)+"&lat=........
to
http://*YOURSERVERHERE*:5055/?id="+($serial)+"&lat=........
this would send the serial as the id instead of the imei.
hope this helps.
I have a fleet of windows surface tablets that I maintain and I wanted to see if we can add them to traccar.
This is the powershell script I hashed out. I will probably make it into a windows service executable or something later. I figured if anyone needs something this would get you in the right direction.