Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

changing SQL account password in specific database

$
0
0


I am trying to change the password for userId in a specific database called LionsDB.

$srv = New-Object "Microsoft.SqlServer.Management.Smo.Server" $ServerName

$SQLUser = $srv.Logins | ? {$_.Name -eq "$login"};

$SQLUser.ChangePassword($password);


My problem is, I cant find the specific logins in the LionsDB database. The above code gives me the logins at server level. Is there anyway to get to the userIDs in specific catalog and change password for them?

 

I am trying to change the password for userIdin a specific database called LionsDB.

$srv = New-Object "Microsoft.SqlServer.Management.Smo.Server" $ServerName
$SQLUser = $srv.Logins | ? {$_.Name -eq "$login"};
$SQLUser.ChangePassword($password);

My problem is, I cant find the specific logins in the LionsDB database. The above code gives me the logins at server level. Is there anyway to get to the userIDs in specific catalog and change password for them?

I am trying to change the password for userId in a specific database called LionsDB.

$srv = New-Object "Microsoft.SqlServer.Management.Smo.Server" $ServerName
$SQLUser = $srv.Logins | ? {$_.Name -eq "$login"};
$SQLUser.ChangePassword($password);

My problem is, I cant find the specific logins in the LionsDB database. The above code gives me the logins at server level. Is there anyway to get to the userIDs in specific catalog and change password for them?


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>