Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ssis 使用SSI填充Active Directory_Ssis_Active Directory - Fatal编程技术网

Ssis 使用SSI填充Active Directory

Ssis 使用SSI填充Active Directory,ssis,active-directory,Ssis,Active Directory,我已经看到了大量从广告中提取数据的帖子,但我需要更新广告,却找不到我要找的内容。我的公司一直在使用第三方供应商(intelli desk)为部门、经理和电话etx提供服务。多年的信息。AD只是用来创建用户名和分配域访问权限。我们知道需要使用intelli desk内的信息更新AD。我已经建立了一个查询,比较AD和intelli desk数据库,并希望在sn和givenName匹配并更新Ext.,Dept。,在广告中,我认为SSIS软件包可能是实现这一点的最佳方式,这样它就可以成为一项预定的工作,

我已经看到了大量从广告中提取数据的帖子,但我需要更新广告,却找不到我要找的内容。我的公司一直在使用第三方供应商(intelli desk)为部门、经理和电话etx提供服务。多年的信息。AD只是用来创建用户名和分配域访问权限。我们知道需要使用intelli desk内的信息更新AD。我已经建立了一个查询,比较AD和intelli desk数据库,并希望在sn和givenName匹配并更新Ext.,Dept。,在广告中,我认为SSIS软件包可能是实现这一点的最佳方式,这样它就可以成为一项预定的工作,因为我认为我们不会停止使用第三方软件。有没有人对如何使用SSIS来实现这一点有任何建议?如果有,您将如何进行。如果没有,还可以使用什么

我最近刚刚不得不从数据库中完成类似的任务(插入、更新)Active Directory用户。您可以完成此任务的选项很少:

  • 使用他评论中提到的@billinkc等第三方软件。然而,这种做法弊大于利。它们中的大多数都不具有成本效益,而且,它们限制了您所能做的事情(如果您不购买源代码的话)。我不建议你走这条路

  • 有一种方法可以使用
    SSIS
    包完成此任务。此technet解释如何使用外部源将用户导入Active Directory
    SSIS
    包将使用在
    VBA
    C#
    中编写的外部脚本。本文中提供的
    C#
    示例是在较旧的
    .NET
    库中编写的。它使用的是
    DirectoryEntry
    类。使用这个类没有什么错,但是,在
    .NET3.5
    及更高版本中,Microsoft引入了
    System.DirectoryServices.AccountManagement
    ,使用起来更简单

  • 使用
    AccountManagement
    名称空间自己编写。听起来并不难

  • 由于数据库中有所有用户信息,所以可以编写一个
    存储过程
    ,该过程将返回用户信息

    这里有一些东西让你开始

    通过调用
    存储过程
    从数据库加载用户信息

     public static DataTable GetUserInfoByUsername(string username)
     {
         //call stor proc to return data
         //return datatable or custom class that will hold user iformation
     }
    
    编写两种方法,分别
    创建
    更新
    用户。使用
    datatable
    中的值填充Active Directory中的用户属性

    public static string CreateUser(DataTable dt, string password)
    {
       //CREATE CONNECTION TO ACTIVE DIRECTORY
       using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "yourdomain.com"))
       {
           //CREATE A NEW USERPRINCIPAL OBJECT
           using (UserPrincipal principal = new UserPrincipal(ctx))
           {
              //TODO: you need to populate the below info with values from dt
              principal.Enabled = true; //IF NOT ENABLED YOU CAN'T AUTHENTICATE THE USER
              principal.UserPrincipalName = username;
              principal.Name = "name";
              principal.DisplayName = "firstname lastname";
              principal.EmailAddress = "email@test.com";
              principal.VoiceTelephoneNumber = "12345678910";
              principal.GivenName = "firstname";
              principal.Surname = "lastname";
              principal.SetPassword(password);
              try
              {
                 principal.Save();
              }
              catch(Exception ex)           
              {
                 throw;
              }
           }
        }
     }
    
    您可以采取类似的方法来更新用户

    public static void UpdateUser(string userName, DataTable dt)
    {
        using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "yourdomain.com"))
        {
            //you have more than one way to search for a user in AD. Identitype has more choises
            using (UserPrincipal principal = UserPrincipal.FindByIdentity(ctx, Identitype.samAccountName, username))
            {
                if (principal !== null)
                //update user properties with data from datatable dt
                ...
                principal.Save();
            }
        }
    }
    
    要记住的东西。默认情况下,
    UserPrincipal
    类不会显示每个active directory属性。获取这些属性的最快方法是使用
    DirectoryEntry
    class。您可以调用
    getUnderlineObject()
    方法的
    principal

    DirectoryEntry de = (principal.GetUnderlyingObject() as DirectoryEntry);
    
    if (de != null)
    {
       if (de.Properties.Contains("company"))
       string company = de.Properties["company"][0].ToString();
    }
    
    如果要运行某种作业来执行这些操作,只需让
    存储过程
    返回所有用户,并在调用这些方法之前使用
    foreach
    循环即可

    我建议您编写一个windows服务并在那里执行所有这些操作


    *注意代码不完整。根据您的需要,您需要修改代码。**

    我最近刚刚从数据库中完成了一项类似的任务(插入、更新)Active Directory用户。您可以完成此任务的选项很少:

  • 使用他评论中提到的@billinkc等第三方软件。然而,这种做法弊大于利。它们中的大多数都不具有成本效益,而且,它们限制了您所能做的事情(如果您不购买源代码的话)。我不建议你走这条路

  • 有一种方法可以使用
    SSIS
    包完成此任务。此technet解释如何使用外部源将用户导入Active Directory
    SSIS
    包将使用在
    VBA
    C#
    中编写的外部脚本。本文中提供的
    C#
    示例是在较旧的
    .NET
    库中编写的。它使用的是
    DirectoryEntry
    类。使用这个类没有什么错,但是,在
    .NET3.5
    及更高版本中,Microsoft引入了
    System.DirectoryServices.AccountManagement
    ,使用起来更简单

  • 使用
    AccountManagement
    名称空间自己编写。听起来并不难

  • 由于数据库中有所有用户信息,所以可以编写一个
    存储过程
    ,该过程将返回用户信息

    这里有一些东西让你开始

    通过调用
    存储过程
    从数据库加载用户信息

     public static DataTable GetUserInfoByUsername(string username)
     {
         //call stor proc to return data
         //return datatable or custom class that will hold user iformation
     }
    
    编写两种方法,分别
    创建
    更新
    用户。使用
    datatable
    中的值填充Active Directory中的用户属性

    public static string CreateUser(DataTable dt, string password)
    {
       //CREATE CONNECTION TO ACTIVE DIRECTORY
       using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "yourdomain.com"))
       {
           //CREATE A NEW USERPRINCIPAL OBJECT
           using (UserPrincipal principal = new UserPrincipal(ctx))
           {
              //TODO: you need to populate the below info with values from dt
              principal.Enabled = true; //IF NOT ENABLED YOU CAN'T AUTHENTICATE THE USER
              principal.UserPrincipalName = username;
              principal.Name = "name";
              principal.DisplayName = "firstname lastname";
              principal.EmailAddress = "email@test.com";
              principal.VoiceTelephoneNumber = "12345678910";
              principal.GivenName = "firstname";
              principal.Surname = "lastname";
              principal.SetPassword(password);
              try
              {
                 principal.Save();
              }
              catch(Exception ex)           
              {
                 throw;
              }
           }
        }
     }
    
    您可以采取类似的方法来更新用户

    public static void UpdateUser(string userName, DataTable dt)
    {
        using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "yourdomain.com"))
        {
            //you have more than one way to search for a user in AD. Identitype has more choises
            using (UserPrincipal principal = UserPrincipal.FindByIdentity(ctx, Identitype.samAccountName, username))
            {
                if (principal !== null)
                //update user properties with data from datatable dt
                ...
                principal.Save();
            }
        }
    }
    
    要记住的东西。默认情况下,
    UserPrincipal
    类不会显示每个active directory属性。获取这些属性的最快方法是使用
    DirectoryEntry
    class。您可以调用
    getUnderlineObject()
    方法的
    principal

    DirectoryEntry de = (principal.GetUnderlyingObject() as DirectoryEntry);
    
    if (de != null)
    {
       if (de.Properties.Contains("company"))
       string company = de.Properties["company"][0].ToString();
    }
    
    如果要运行某种作业来执行这些操作,只需让
    存储过程
    返回所有用户,并在调用这些方法之前使用
    foreach
    循环即可

    我建议您编写一个windows服务并在那里执行所有这些操作


    *注意代码不完整。根据您的需要,您需要修改代码。**

    可能有第三方组件,我会先检查CozyRoc,否则您会将.NET脚本作为目标。您感兴趣的方法位于
    System.DirectoryServices
    库中。这就是说,能够完成这一壮举的帐户将在你的环境中拥有上帝般的力量,所以要小心,可能是第三个pa