Reset SA Password

Can we reset password of SA account through sqlcmd?

Why not? Just use sp_password or ALTER LOGIN once authenticated.

I think the command line query would be:

EXEC sp_password 'old_password' , 'new_password', 'sa'

Sorry, I am getting an error message "Login failed for user 'username'. (Microsoft SQL Server, Error: 18456)

You can follow the directions on this page:

Hi jason_clark,
You can use these commands to reset SQL Server SA password:

sqlcmd -S <InstanceName> -q "ALTER LOGIN sa WITH NAME = [my_sa_login]"
sqlcmd -S <InstanceName> -q "ALTER LOGIN [sa] WITH PASSWORD=N'NewPassword' MUST_CHANGE"

and if you need to disable the sa:

sqlcmd -S <InstanceName> -q "ALTER LOGIN sa DISABLE"

Hope it will help you out.