October 9, 2005 at 9:58 am
can sql server get to - local user accounts ??
i wont to get all the users and the local groups from Windows Server
in my Server (Doamin)
and insert to new table in sql server
thnks
October 9, 2005 at 8:31 pm
you cannot get domain group members by using t-sql that I aware of.
October 11, 2005 at 12:59 pm
and if i am The ADMINISTRATOR ???
October 11, 2005 at 2:09 pm
Are you using AD ?
if Yes create a linked server and then interrogate it :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/distributed_query.asp
If no
Then run:
create table #t1 (data varchar(255))
insert into #t1 exec master..xp_cmdshell 'net user'
select -- this parsing is just as a demo purpose you may need to change it for your own case
Left(data, charindex(' ', data, 1)) FirstCol,
Substring(data,26,charindex(' ', data, 26)- 25) SecondCol,
Substring(data,51,charindex(' ', data, 51) - 50) ThirdCol
from #t1
where data is not null
and data not like '%\\%'
and data not like 'The command completed successfully.%'
and data not like '-----------------%'
drop table #t1
* Noel
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply