Scope-IT / marksman

Windows agent for Snipe-IT asset management system
Apache License 2.0
132 stars 23 forks source link

Already exists in DB #19

Closed emike09 closed 5 years ago

emike09 commented 5 years ago

The agent has suddenly stopped working for us. It says the item already exists in the database, but when browsing the database tables, the entry does not exist at all.

We did customize the code for the serial number so it queries the BIOS for the asset tag, so that may have something to do with it (See my fork for the code changes).

Any thoughts?

C:\Program Files (x86)\Marksman Scope-IT Agent>marksman 06/13/2019 4:18:48 PM: Started application. HTTP 200: Connection to Snipe-IT instance succeded. Attempting to create type: SnipeSharp.Endpoints.Models.Manufacturer Instance name: System manufacturer Already exists in DB Attempting to create type: SnipeSharp.Endpoints.Models.Category Instance name: Desktop Already exists in DB Attempting to create type: SnipeSharp.Endpoints.Models.Model Instance name: System Product Name Already exists in DB Attempting to create type: SnipeSharp.Endpoints.Models.Company Instance name: Choose Company Already exists in DB Attempting to create type: SnipeSharp.Endpoints.Models.StatusLabel Instance name: In Production Already exists in DB Attempting to create type: SnipeSharp.Endpoints.Models.Location Instance name: Select Location Already exists in DB Attempting to create type: SnipeSharp.Endpoints.Models.Asset Instance name: S1W10-ITADMIN Already exists in DB Total program execution time 1186ms. 06/13/2019 4:18:49 PM: Exiting application.

danielhogg commented 5 years ago

I've run into this same issue as well. In order to preserve history, SnipeIT has a feature that when assets are deleted, they aren't really removed from the database unless you explicitly specify to purge records:

Does your asset show up in the 'Deleted' assets table in your SnipeIT dashboard?

emike09 commented 5 years ago

I've had to purge records in the past, which can by annoying because I want some records to remain as deleted, such as LDAP service accounts that I don't want re-added when doing an LDAP import for new employees.

This happens with brand new systems as well.

Honestly, the error doesn't exist in the vanilla marksman 1.01 client. It has something to do with my modifications for grabbing the asset tag from the bios for the Asset ID, which normally pulls the service tag instead of the asset tag. Because it's a custom modification, I don't expect any support, but tips are appreciated.

A comparison of the changes: https://github.com/emike09/marksman/commit/84d0da92e461c18ad30602d27e3f87dc2993b0ff#diff-18d0b07d59e58441a6eb8ffbb2a582d3

emike09 commented 5 years ago

Strangely, building the fork again and assembling into an MSI fixed the issue. No other changes. Sorry to take everyone's time.