如果使用ldapsearch,ldapadd,ldapdelete等实用程序查询Active Directory服务器,是否可以让任何人知道?
起初我认为下面的代码有效,因为如果我将该组作为"IT"它正常运行,因为我的用户名在活动目录中的IT组中.我学到的是,无论我是否在IT组中拥有我的用户名,它总是返回,如果我将其更改为我所在的任何其他组,则返回始终返回false.任何帮助,将不胜感激.
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
// tab control security for admin tab
bool admin = checkGroup("IT");
if ((admin == true) && (tabControl1.SelectedTab == tpHistory))
{
tabControl1.SelectedTab = tpHistory;
}
else if ((admin == false) && (tabControl1.SelectedTab == tpHistory))
{
tabControl1.SelectedTab = tpRequests;
MessageBox.Show("Unable to load tab. You have insufficient privileges.",
"Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
}
// check active directory to see if user is in Marketing department group
private static bool checkGroup(string group)
{
WindowsIdentity identity …
Run Code Online (Sandbox Code Playgroud) 我遇到这个命令有问题:
gc .\domains.txt | Get-ADDomain
Run Code Online (Sandbox Code Playgroud)
顾名思义,domains.txt包含要查询的Active Directory列表(所有域都在同一个林中).
If I run it on my Windows 8 machine everything works fine and I get the expected results, instead on a Windows 2008 R2 SP1 member server (not a DC) with WMF 3.0 I get result only from the first domain in the list and for the others:
Get-ADDomain : A referral was returned from the server
Run Code Online (Sandbox Code Playgroud)
If I query a domain in the list with:
Get-ADDomain <Domain name here>
Run Code Online (Sandbox Code Playgroud)
it works fine. …
我有一个非常短的PowerShell脚本连接到服务器并导入AD模块.我想通过双击来运行脚本,但我担心窗口会在最后一行后立即关闭.
我该如何解决这个问题?
是否有任何内置的实用程序或帮助程序来解析HttpContext.Current.User.Identity.Name
,例如domain\user
,如果存在和用户单独获取域名?
或者还有其他课程吗?
我知道这很容易打电话String.Split("\")
但很有意思
我需要一种方法来查看用户是否是我的.Net 3.5 asp.net c#应用程序中的活动目录组的一部分.
我正在使用msdn的标准ldap身份验证示例,但我真的没有看到如何检查组.
我一直试图将Rails应用程序挂钩到ActiveDirectory.我将同步AD和数据库之间的用户数据,目前是MySQL(但可能会变成SQL Server或PostgreSQL).
我已经检查了activedirectory-ruby,它看起来真的很麻烦(1.0发布!?).它包装了Net :: LDAP,所以我尝试使用它,但它非常接近LDAP的实际语法,并且我喜欢ActiveDirectory-Ruby的抽象,因为它具有类似ActiveRecord的语法.
是否有一个优雅的ORM类型的目录服务器工具?更好的是,如果有一些用于LDAP的脚手架工具(用户,组,组织单位等的CRUD).然后,我可以通过Authlogic快速将其与我现有的身份验证代码集成,并保持所有数据同步.
是否可以创建一个LDAP查询,该查询将返回(或检查)嵌套组中的用户?例如,UserA是GroupA的成员,GroupA是GroupB的成员.我希望GroupB上的查询返回UserA是一个成员.仅限LDAP.服务器是Active Directory.
我想用C#连接到我们的本地Active Directory.
我发现这篇文章很好.
但我真的不知道如何通过LDAP连接.
有人可以解释如何使用询问的参数吗?
示例代码:
static DirectoryEntry createDirectoryEntry()
{
// create and return new LDAP connection with desired settings
DirectoryEntry ldapConnection = new DirectoryEntry("rizzo.leeds-art.ac.uk");
ldapConnection.Path = "LDAP://OU=staffusers,DC=leeds-art,DC=ac,DC=uk";
ldapConnection.AuthenticationType = AuthenticationTypes.Secure;
return ldapConnection;
}
Run Code Online (Sandbox Code Playgroud)
我只有Active Directory服务器的主机名和IP地址.什么DC=xxx,DC=xx
等等意味着什么?
我正在编写以下方法来在C#中添加和删除活动目录中的用户.
void AddUserToGroup(string userId, string groupName);
void RemoveUserFromGroup(string userId, string groupName);
Run Code Online (Sandbox Code Playgroud)
如何最好地实现这些方法?
以下是CodeProject的一些代码.我在这些示例中看不到AD服务器的位置?(在使用LDAP协议时,它是由.NET框架隐式提供的吗?).这些例子值得关注吗?
public void AddToGroup(string userDn, string groupDn)
{
try
{
DirectoryEntry dirEntry = new DirectoryEntry("LDAP://" + groupDn);
dirEntry.Properties["member"].Add(userDn);
dirEntry.CommitChanges();
dirEntry.Close();
}
catch (System.DirectoryServices.DirectoryServicesCOMException E)
{
//doSomething with E.Message.ToString();
}
}
public void RemoveUserFromGroup(string userDn, string groupDn)
{
try
{
DirectoryEntry dirEntry = new DirectoryEntry("LDAP://" + groupDn);
dirEntry.Properties["member"].Remove(userDn);
dirEntry.CommitChanges();
dirEntry.Close();
}
catch (System.DirectoryServices.DirectoryServicesCOMException E)
{
//doSomething with E.Message.ToString();
}
}
Run Code Online (Sandbox Code Playgroud)