djodjo1989 0 Newbie Poster

djodjo1989


Hello everybody,
First sorry for my english because i'm French,
here it goes, i'd like to add a new user, for example HelpDesktop to the localgroup Administrators, for example.
But i disabled xp_cmdshell for security reasons and i renamed the xplog70.dll DLL. I know the easiest would be to restore everything but i found it interesting to see if it was possible to add a new user to the server without using xp_cmdshell but only a SQL script.

I've already found this to make a new directory:

DECLARE @jobID uniqueidentifier, @cmd varchar(1000)

SET @cmd = 'md "E:\Backups\dbname_20080611"'

EXEC msdb.dbo.sp_add_job @job_name = '_tmp_MakeDirectory', @enabled  = 1, @start_step_id = 1, @owner_login_name='sa', @job_id = @jobID OUTPUT

EXEC msdb.dbo.sp_add_jobstep @job_id = @jobID, @step_name = 'Create Backup Folder', @step_id = 1, @subsystem = 'CMDEXEC', @command = @cmd

EXEC msdb.dbo.sp_add_jobserver @job_id = @jobID

EXEC msdb.dbo.sp_start_job @job_id = @jobID, @output_flag = 0

WAITFOR DELAY '000:00:05' -- Give the job a chance to complete

IF EXISTS (SELECT name FROM msdb.dbo.sysjobs WHERE name = '_tmp_MakeDirectory')
BEGIN
     EXEC msdb.dbo.sp_delete_job @job_name = '_tmp_MakeDirectory'
END

Now i'm looking for a way to add a new user,
Thanks a lot for your help!