Quick google of that command, it is part of the SqlServer module. My best guess is that your SqlServer module is out of date or corrupted in some form. I would re-install the SQL Server module (note this is NOT the SQLPS module) and try it again.
You can also run "Get-Module -ListAvailable" to make sure that the SQL Server module exists. Again though, the SQLPS module is NOT the same thing as SQLServer module.
The above is all just my opinion on what you should do.
As with all advice you find on a random internet forum - you shouldn't blindly follow it. Always test on a test server to see if there is negative side effects before making changes to live!
I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.