I am writing a power shell script and need to connect to sql server. I have searched the people suggest to add this code:
Add-PSSnapin SqlServerCmdletSnapin10