I wrote a script long ago which actually started in a Technet froum thread that removes the computer from the OSD collection after a successful OS deployment using a status filter rule. I have used it many times since. https://ccmexec.com/2012/07/remove-from-collection-and-clear-pxe-flag-vbscript-using-status-filter-rule/
Now I thought that the time had come to re-write it in Powershell instead, but I found that this had already been done.. It can be found here:
So instead of re-writing the script I will post the link here instead.