Thanks to LucD on the forum for showing me this little trick today. To prompt for a username and password in get-viserver pass a -credentials argument to the command. For example
get-viserver <Virtual Center Server Name> -Credentials (get-credential)
that will prompt for a username and password rather than having to put it into the script.