Assign missing tag to VM

We run our backup job schedules based on the tags assigned to the VM. This keeps it relatively simple and to add a system to a backup job you only need to tag it, not go into another software and edit a backup job.Recently, while working on a production system I noticed it wasn’t tagged! Whoever had created it never tagged it and so it’s been in production for a while and has never been protected. Obviously, this is a bad situation and I needed to make sure it was fixed across the board. Did a quick PowerCLI script to find and assign a nightly backup job to anything it found. We can go back and audit this later if a system needs better protection.
$Tag = get-tag -Category "BDR" -Name Bronze
Get-VM | Where-Object {(Get-TagAssignment $_) -eq $null} | New-TagAssignment -Tag $Tag