Microsoft Test Braindumps

Archive for August, 2007

Filed Under (microsoft) by admin on August-27-2007

There is a matter of creating a batch of users, when we finished the installation of company servers. We can new a user by using windows user creation wizard, but it’ll be a time exhaust for creating a bulk of users. So we need some methods of batching to create users.We’ll detail some methods of batching to create users in my blog.


The first method:

Generally, the staff information of a corporation is stored in Database system (Such as Microsoft SQL Server). We can use cycle language and some procedures of Microsoft SQL Server to new a batch of users.

We needs:
1.
       We run “Xp_cmdshell dsadd users …” in SQL server to execute Windows command “dsadd users” which use to create a user for Windows server.
2.
       To new all users, we should use cycle language to repeat “Xp_cmdshell dsadd users …” in SQL server.

 Situation Requirement:
1.
       The server in which Microsoft SQL located should be a member server of AD (Active Directory).
2.
       If your Database system is Microsoft SQL server2005, XP_CMDShell store procedure should be active. The following codes is use to active:
      sp_configure ’show advanced options’, 1;
      RECONFIGURE; GO
      sp_configure ‘xp_cmdshell’, 1;
      RECONFIGURE;Go

3.       We should have a staff information table maintained by Human Resource department stored in Microsoft SQL server. Just like the following table named Employee_info:
    EmployeeID     FirstName     Lastname     Department     Status  
    001                    Alexander      Gerke             Gr1-B               Current      …
    002                    Rachelle          Lui                 Gr1-B               Current      …
    003                    Rin                  Inuzuka         Gr1-A               Current      …
    004                    Thierry          Ky                   Gr1-A               Current      …
 

Steps:
1. The command is run in Windows command shell to new a user. The user display name is “Alexander Gerke”, located in Sales OU. Password is mcse@123.   

dsadd user cn=Alexander Gerke,ou=Sales,dc=dong,dc=com -samid AlexanderGerke -upn AlexanderGerke@dong.com -display “Alexander Gerke” -pwd mcse@123

2. Write a SQL server Code to execute the upper cmdlet in SQL server.
         Master..xp_cmdshell “dsadd user cn=…”

3. Structure a cycle language code to new users for all employees.

declare @command nvarchar(200), @Name nvarchar(50), @department nvarchar(10), @Employeeid nvarchar(10), @rowcount int
select @rowcount=count(*) from Employee_infoset @Employeeid=1
while @Employeeid<=@rowcount
    begin

          select @department=Department, @Name=Firstname+Lastname from Employee_info where id=@employeeid
          set @command=’dsadd user cn=’+@Name+’, ou=’@department+’, dc=dong, dc=com –samid ‘+ @Name+’ -upn ‘+ @Name+’@dong.com -display ‘+ @Name+’ -pwd mcse@123′
          Exec master..XP_cmdshell @command
          set @Employeeid=@employeeid+1
   End      

Comments:

The codes can create users for all employees, but they omit any possibly question, such as same name, a existing name or more information should be write for a user, and so on.  

Also, we should especially care the blank in the following codes.

@command=’dsadd user cn=’+@Name+’,ou=’@department+’,dc=dong,dc=com –samid ‘+@Name+’ -upn ‘+@Name+’@dong.com -display ‘+@Name+’ -pwd mcse@123′ 


Filed Under (microsoft) by admin on August-23-2007

There is a matter of creating a batch of users, when we finished the installation of company servers. We can new a user by using windows user creation wizard, but it’ll be a time exhaust for creating a bulk of users. So we need some methods of batching to create users. We’ll detail some methods of batching to create users in my blog. And I wish more guys to share their favorite methods in my blog.