草庐IT

safe.directory

全部标签

c# - Active Directory (LDAP) - 检查帐户锁定/密码过期

目前,我使用以下代码针对某些AD对用户进行身份验证:DirectoryEntryentry=newDirectoryEntry(_path,username,pwd);try{//BindtothenativeAdsObjecttoforceauthentication.Objectobj=entry.NativeObject;DirectorySearchersearch=newDirectorySearcher(entry){Filter="(sAMAccountName="+username+")"};search.PropertiesToLoad.Add("cn");Searc

c# - 如何根据姓氏和名字在 Active Directory 中搜索用户?

关闭。这个问题是notreproducibleorwascausedbytypos.它目前不接受答案。这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topic在这里,这个问题的解决方式不太可能帮助future的读者。关闭6年前。Improvethisquestion我正在尝试使用DirectorySearcher在.NET.我可以使用以下代码找到基于sAMAccountname的用户:DirectorySearchersearcher1=newDirectorySearcher(entry);searcher1.Filter=string.Format("(&

c# - 从给定 AD 组中的 Active Directory 获取用户列表

我有搜索部门中所有用户的代码:stringDepartment="Billing";DirectorySearcherLdapSearcher=newDirectorySearcher();LdapSearcher.PropertiesToLoad.Add("displayName");LdapSearcher.PropertiesToLoad.Add("cn");LdapSearcher.PropertiesToLoad.Add("department");LdapSearcher.PropertiesToLoad.Add("title");LdapSearcher.Properti

c# - 在 .NET (C#) 中创建 Active Directory 用户

我需要在ActiveDirectory中创建一个新用户。我发现了几个类似下面的例子:usingSystem;usingSystem.DirectoryServices;namespacetest{classProgram{staticvoidMain(string[]args){try{stringpath="LDAP://OU=x,DC=y,DC=com";stringusername="johndoe";using(DirectoryEntryou=newDirectoryEntry(path)){DirectoryEntryuser=ou.Children.Add("CN="+u

c# - 任何方法到 "Safely"调用 assembly.GetTypes()?

我到处搜索,但找不到解决方案。我需要使用如下代码从程序集中获取所有接口(interface)类型:IEnumerableinterfaces=_assembly.GetTypes().Where(x=>x.IsInterface);问题是,对于某些程序集,我遇到了以下错误:Unabletoloadoneormoreoftherequestedtypes.RetrievetheLoaderExceptionspropertyformoreinformation.我完全清楚为什么会发生这种情况(未加载依赖程序集),以及如果我想对特定程序集进行故障排除时如何解决。就我而言,我不知道前面的程序

c# - 获取 Active Directory 组的成员并检查他们是启用还是禁用

获取给定AD组中所有成员/用户的列表并确定用户是否启用(或禁用)的最快方法是什么?我们可能会谈论20K用户,所以我想避免为每个用户点击广告。 最佳答案 如果您使用的是.NET3.5及更高版本,则应查看System.DirectoryServices.AccountManagement(S.DS.AM)命名空间。在这里阅读所有相关信息:ManagingDirectorySecurityPrincipalsinthe.NETFramework3.5MSDNdocsonSystem.DirectoryServices.AccountMan

docker - 错误 : Cannot Start Container: stat/bin/sh: no such file or directory"

已结束。这个问题是notreproducibleorwascausedbytypos.它目前不接受答案。此问题是由拼写错误或无法再重现的问题引起的。虽然类似的问题可能是on-topic在这里,这个问题的解决方式不太可能帮助future的读者。关闭2年前。Improvethisquestion我一直在尝试创建自己的busybox基础镜像。#./mkimage.sh-tpensu/busyboxbusybox-static+mkdir-p/var/tmp/docker-mkimage.US3tHy0uBQ/rootfs+tar--numeric-owner-caf/var/tmp/dock

docker - 错误 : Cannot Start Container: stat/bin/sh: no such file or directory"

已结束。这个问题是notreproducibleorwascausedbytypos.它目前不接受答案。此问题是由拼写错误或无法再重现的问题引起的。虽然类似的问题可能是on-topic在这里,这个问题的解决方式不太可能帮助future的读者。关闭2年前。Improvethisquestion我一直在尝试创建自己的busybox基础镜像。#./mkimage.sh-tpensu/busyboxbusybox-static+mkdir-p/var/tmp/docker-mkimage.US3tHy0uBQ/rootfs+tar--numeric-owner-caf/var/tmp/dock

c# - 如何从 Active Directory 获取用户的电子邮件地址?

我试图在AD中获取用户的电子邮件地址,但没有成功。Stringaccount=userAccount.Replace(@"Domain\","");DirectoryEntryentry=newDirectoryEntry();try{DirectorySearchersearch=newDirectorySearcher(entry);search.PropertiesToLoad.Add("mail");//e-mailaddresseadSearchResultresult=search.FindOne();if(result!=null){returnresult.Proper

c# - UnauthorizedAccessException 无法解决 Directory.GetFiles 失败

这个问题在这里已经有了答案:Ignorefolders/fileswhenDirectory.GetFiles()isdeniedaccess(8个答案)关闭6年前。Directory.GetFilesmethod第一次遇到它没有访问权限的文件夹时失败。该方法抛出一个UnauthorizedAccessException(可以被捕获),但在完成时,该方法已经失败/终止。我使用的代码如下:try{//looksinstateddirectoryandreturnsthepathofallfilesfoundgetFiles=Directory.GetFiles(@directoryToS