Once an Active Directory computer is disabled, it can't be disabled more/again, so I have never had a need to avoid disabling an already disabled computer. If the error interferes with the script, you can try to add -ErrorAction Ignore to the part in the script that disables the computer.
I've updated the link in the description, but you can find the scripts and writeups here: github.com/carlhillit/RUclips/tree/main/Cleanup%20Inactive%20Accounts
How to catch or avoid error if the ForEach-Object loop already found that the user/computer is already disabled?
Once an Active Directory computer is disabled, it can't be disabled more/again, so I have never had a need to avoid disabling an already disabled computer. If the error interferes with the script, you can try to add -ErrorAction Ignore to the part in the script that disables the computer.
Where can i find the script please ?!
I've updated the link in the description, but you can find the scripts and writeups here: github.com/carlhillit/RUclips/tree/main/Cleanup%20Inactive%20Accounts