mssql login script

5 pts.
Tags:
MSSQL
PowerShell Scripts
SQL 2005
SQL scripts
Windows Server 2008
Hello, Can anyone give me a simplet powershell script to check login attempt to remote MSSQL database.For eg: if i have a database "db" in remote sql server say 192.168.1.10 which having username"test" and password as "password".If the login is successful its output should shows as "OK" in powershell prompt itself or  as "FAIL",if it fails to login. Regards, Linson

Software/Hardware used:
windows 2008 + MSSQL 2005

Answer Wiki

Thanks. We'll let you know when a new response is added.

This is possible. I have a script that does something similiar but I am using integrated security. Check out this link as I think it will help you out.

http://www.sqlmusings.com/2009/04/29/sql-server-powershell-basics-connecting-to-sql-server/

You can check out some of mine here.

http://itknowledgeexchange.techtarget.com/dba/powershell-ping/

http://itknowledgeexchange.techtarget.com/dba/sql-ping-servers-improved/

http://itknowledgeexchange.techtarget.com/dba/powershell-ping-cont/

Feel free to use my code or take out parts you need and do what you need with it. Hope it helps.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following