July 13, 2003 at 8:26 pm
I setup users in SQL2000 as XP active directory security groups. That way IT support can add users through active directory and not have to go through enterprise manager.
How can I find out which security group an NT user is in from a stored procedure?
Bruce
July 14, 2003 at 6:40 am
xp_cmdshell will allow you execute the command-line net user. However, this isn't too advisable. We parse users and groups and group memberships nightly using Perl scripts and store the resulting information in SQL Server. We can then replicate this information as needed to the appropriate target servers.
K. Brian Kelley
http://www.truthsolutions.com/
Author: Start to Finish Guide to SQL Server Performance Monitoring
http://www.netimpress.com/shop/product.asp?ProductID=NI-SQL1
K. Brian Kelley
@kbriankelley
July 14, 2003 at 4:52 pm
I'll have to find out how to use net user.
Thanks.
Bruce
July 14, 2003 at 9:26 pm
From the command-line:
net user <user id> /domain
This will hit against a domain controller.
Keep in mind there's a lot of information that'll be returned, so you'll basically have to dump the results into a temporary table and cycle through it.
K. Brian Kelley
http://www.truthsolutions.com/
Author: Start to Finish Guide to SQL Server Performance Monitoring
http://www.netimpress.com/shop/product.asp?ProductID=NI-SQL1
K. Brian Kelley
@kbriankelley
July 15, 2003 at 6:20 pm
all I get is "The command completed successfully."
this is the sp:
CREATE PROCEDURE dbo.uspNetUser
@user varchar(50)
AS
set @user = 'net user ' + @user + ' /domain domainname'
set nocount on
exec master..xp_cmdshell @user
set nocount off
GO
Bruce
July 15, 2003 at 10:35 pm
Create a temporary table. Insert into it using EXEC xp_cmdshell as the source. Then you'll have to filter through the temporary table.
K. Brian Kelley
http://www.truthsolutions.com/
Author: Start to Finish Guide to SQL Server Performance Monitoring
http://www.netimpress.com/shop/product.asp?ProductID=NI-SQL1
K. Brian Kelley
@kbriankelley
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply