Home Asset Management

Should I use SerialNumber or MachineName as primary key for computers ?

Stephane_BouillonStephane_Bouillon Customer Advanced IT Monkey ✭✭✭
Hi, I'm about to upload a list of Hardware Assets. I seem to recall from a seminar that it's not a good idea to use the machine name as the primary key for HW assets. What is the best practice ?

Best Answers

Answers

  • Stephane_BouillonStephane_Bouillon Customer Advanced IT Monkey ✭✭✭
    So the GUID is the primary key, and then machine name and SvcTag are just fields of the HWAsset object, correct ?
  • damon_mulligandamon_mulligan Cireson Consultant Advanced IT Monkey ✭✭✭
    Correct
  • Geoff_RossGeoff_Ross Cireson Consultant O.G.
    Correct
  • Stephane_BouillonStephane_Bouillon Customer Advanced IT Monkey ✭✭✭
    What I did was generate a csv file from a list of known machines to obtain the manufacturer, model and SerialNumber and import those with the Asset Import connector

    ...
    loop through IP adresses ...<br id="null">$BIOS = Get-WMIOBject -namespace "root\cimv2" -Class Win32_BIOS -Impersonation 3 -Computername $($ip) -ErrorAction SilentlyContinue<br>$ComputerSystem = Get-WMIOBject -namespace "root\cimv2" -Class Win32_ComputerSystem -Impersonation 3 -Computername $($ip)<br>$Machine = [pscustomobject] @{Machine=$($ComputerSystem.Name);IP=$($ip);SerialNumber=$($BIOS.SerialNumber);Manufacturer=$($BIOS.Manufacturer);Model=$($Computersystem.Model);ID=$(New-Guid)}<br>$Machine | Export-Csv -Path "D:\Processes\Config\POS-Machines.csv" -NoTypeInformation -Append<br>
Sign In or Register to comment.