Quite right, sir. The dbatools.io script is dandy, but doesn't address the OP's question. It looks like the script posted by the OP and tweaked by Jack 95169 will do...
"If the women don't find you handsome, they should at least find you handy." Red Green