March 31, 2012 at 5:38 pm
Hello,
If I create a SQL Login using a Active Directory Account is there a way to check if the account can log into SQL Before i give it out. I tried sqlcmd but I couldn't get it to work. Is that for SQL accounts only?
Thanks for any help
Accidental DBA
April 1, 2012 at 7:25 am
n00bDBA (3/31/2012)
Hello,If I create a SQL Login using a Active Directory Account is there a way to check if the account can log into SQL Before i give it out. I tried sqlcmd but I couldn't get it to work. Is that for SQL accounts only?
Thanks for any help
Accidental DBA
Hi,
Of course there is a way. Pleas see this http://stackoverflow.com/questions/5029014/how-to-add-active-directory-user-group-as-login-in-sql-server
Regards
Igor Micev,My blog: www.igormicev.com
April 3, 2012 at 4:04 am
Hi,
Im happy (well happy enough) on how to make the account!
Its how to check the account works.
With ODBC i think I would have to log in as the account to check Windows Authentication.
I cant work out how to use .UDL with a Windows Auth i tried "account@domain.local"
I cant get SQLCMD to use a different Windows auth
Im hoping that its just me doing it wrong!
Thanks
April 3, 2012 at 7:02 am
Click the Start button.
Navigate to Programs/Accessories
Right-click on Command Prompt
Click "Run as..."
Click "The following user:" radio button
Type the AD user name and password and click the OK button
In the Command Prompt window, at the prompt, type SQLCMD /S yourserver /E and press enter
At the 1> prompt, type SELECT SUSER_SNAME() and press enter
At the 2> prompt, type GO and press enter
Your query will return the name of the user that you're logged in as
At the 1> prompt type QUIT and press enter.
April 3, 2012 at 7:10 am
This works in SSMS
-- Change execution context to the desired login
EXECUTE AS LOGIN = 'Domain\LoginName';
GO
--Check the execution context
SELECT SUSER_NAME();
GO
-- Do stuff
--Revert to me
REVERT;
GO
April 3, 2012 at 7:15 am
<LOL>
Thanks, Cath. That's what came to mind for me as well when I first read his post but it seemed he had his heart set on using SQLCMD. Maybe I read too much into it but I haven't had my coffee yet so everything is sorta blurry... <g>
April 3, 2012 at 8:14 am
haha!
your both geniuses!
Thanks for opening my eyes!
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply