开发者

T-SQL - Creating a Local User On Windows OS

My requirement is that I need to create a local user on my System (On my Windows O开发者_C百科S) using T-SQL. And I need to set this user under ‘Administrators’ group.

Using this local user I should be able to login to my Windows OS (At System Startup).

Is it possible? If so may I know how could we do this?


You might want to look into xp_cmdshell for T-SQL

Example

The rows are returned in an nvarchar(255) column.

Executing this xp_cmdshell statement returns the following result set:

xp_cmdshell 'dir *.exe', NO_OUTPUT

You should also look over the security when doing this, see this msdn article

Adding users through command line

See this documentation on adduser

Syntax

Create Users:

        AddUsers /c filename [/s:x] [/?] Domain Password_options  

Dump to file:

        AddUsers /d{:u} filename [/s:x] [/?] Domain Password_options  

Erase Users:

        AddUsers /e filename [/s:x] [/?] Domain Password_options
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜