Dela via


ServerConnection.ChangePassword Method (String)

Changes the logon password that is used with standard authentication.

Namespace:  Microsoft.SqlServer.Management.Common
Assembly:  Microsoft.SqlServer.ConnectionInfo (in Microsoft.SqlServer.ConnectionInfo.dll)

Syntax

'Declaration
Public Sub ChangePassword ( _
    newPassword As String _
)
'Usage
Dim instance As ServerConnection
Dim newPassword As String

instance.ChangePassword(newPassword)
public void ChangePassword(
    string newPassword
)
public:
void ChangePassword(
    String^ newPassword
)
member ChangePassword : 
        newPassword:string -> unit 
public function ChangePassword(
    newPassword : String
)

Parameters

Remarks

The login property must be set before this method may be called.

Examples

C#

ServerConnection conn = new ServerConnection();
conn.LoginSecure = false;
conn.Login = vlogin;
conn.password = vpassword;
conn.ChangePassword(newpassword);

PowerShell

$conn = new-object Microsoft.SqlServer.Management.Common.ServerConnection
$conn.LoginSecure = $FALSE
$conn.Login = vlogin
$conn.Password = vpassword
$conn.ChangePassword newpassword

See Also

Reference

Other Resources

Configuring SQL Server Access for SQL Server Authentication