There are several variations of how to do this, but they all boil down to checking whether the Get-QADComputer or Remove-QADObject commands produced any errors. When processing one object at a time like this, I prefer to use try/catch blocks in conjunction with -ErrorAction Stop:
Your function would be better named “Remove-Computer,” as “Delete” is not a standard PowerShell verb, and the standard is to use singular nouns. Also, it’s more usual to let the shell prompt for input as part of a parameter, than to manually use Read-Host.
If you run your function using the -Verbose parameter, you’ll see the “Remove ” output. Using Write-Verbose is the standardized way of displaying “status” messages from within a script; those messages are suppressed by default, but shown when you add -Verbose.
By declaring $InputFile as a parameter, you can specify it when you run the command: “Remove-Computer -InputFile whatever.txt”. But, if you forget, the shell will prompt you automatically. It’s generally preferred to let that happen, so that all input comes in the form of a parameter value, rather than prompting for input within the function. When you use Read-Host, you can’t ever automate the use of your function, because that interactive prompt will always be there. When you use a parameter, you have the option of doing it either way - providing it in advance, or being prompted. More flexible.