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

Stephane_BouillonStephane_Bouillon Customer 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 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 Super IT Monkey ✭✭✭✭✭
    Correct
  • Stephane_BouillonStephane_Bouillon Customer 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 ...
    $BIOS = Get-WMIOBject -namespace "root\cimv2" -Class Win32_BIOS -Impersonation 3 -Computername $($ip) -ErrorAction SilentlyContinue
    $ComputerSystem = Get-WMIOBject -namespace "root\cimv2" -Class Win32_ComputerSystem -Impersonation 3 -Computername $($ip)
    $Machine = [pscustomobject] @{Machine=$($ComputerSystem.Name);IP=$($ip);SerialNumber=$($BIOS.SerialNumber);Manufacturer=$($BIOS.Manufacturer);Model=$($Computersystem.Model);ID=$(New-Guid)}
    $Machine | Export-Csv -Path "D:\Processes\Config\POS-Machines.csv" -NoTypeInformation -Append
    ...
Sign In or Register to comment.