{"id":16339548,"url":"https://github.com/captainqwerty/activedirectoryeasyapi","last_synced_at":"2025-03-22T23:33:01.908Z","repository":{"id":115292538,"uuid":"141835595","full_name":"captainqwerty/ActiveDirectoryEasyAPI","owner":"captainqwerty","description":"A selection of tools for common Active Directory tasks and audting.","archived":false,"fork":false,"pushed_at":"2023-02-05T19:41:22.000Z","size":1430,"stargazers_count":6,"open_issues_count":12,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T15:48:59.752Z","etag":null,"topics":["account-management","activedirectory","csharp","dotnet"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/captainqwerty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-21T18:08:34.000Z","updated_at":"2022-01-28T17:13:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"6ce0e326-6962-48cf-9d51-0b6b570af04b","html_url":"https://github.com/captainqwerty/ActiveDirectoryEasyAPI","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/captainqwerty%2FActiveDirectoryEasyAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/captainqwerty%2FActiveDirectoryEasyAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/captainqwerty%2FActiveDirectoryEasyAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/captainqwerty%2FActiveDirectoryEasyAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/captainqwerty","download_url":"https://codeload.github.com/captainqwerty/ActiveDirectoryEasyAPI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245036127,"owners_count":20550662,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["account-management","activedirectory","csharp","dotnet"],"created_at":"2024-10-10T23:54:34.338Z","updated_at":"2025-03-22T23:33:01.896Z","avatar_url":"https://github.com/captainqwerty.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ActiveDirectoryTools\n\nThis library gives quick to use methods for Active Directory covering tools to manage accounts, groups and audit tasks.  The API can only perform these tasks if the script / program executing the API is ran from an account with permissions to perform the task being used.\n\nREADME is still no where near done... Currently it's just notes...\n\n## Features\n\n### Audit Tasks Setup and Usage\n\nCreating an instance of the AuditTtasks class.\n```\nvar auditTasks = new AuditTasks();\n```\n\nDoesOrganisationalUnitExist(string organisationalUnit)\n\nUsing this method and supplying the distinguised name of the organisational unit will return a booleon for if it exists or not.\n\n```\nvar ouExists = auditTasks.DoesOrganisationalUnitExist(\"OU=Test Ou,DC=gen2training,DC=co,DC=uk\");\nConsole.WriteLine($\"OU Exists: {ouExists}\")\n\n// If the Ou exists it will return true, if not it will return false.\n```\n\nGetAllLockedOutAccounts()\n\nReturns a UserAccount object for each locked account. \n\n```\nvar lockedOutAccounts = auditTasks.GetAllLockedOutAccounts();\n\nforeach (var lockedAccount in lockedOutAccounts)\n{\n    Console.WriteLine(lockedAccount.Username);\n}\n```\n\n### User Account Tasks\n\nCreating an instance of the UserAccountTasks class.\n```\nvar userAccountTasks = new UserAccountTasks();\n```\n\nGetUserAccountDetails(string username)\n\nFor the supplied username, if the account is found a UserAccount model is returned with populated values based on the information from the account.\n\n```\nvar user = userAccountTasks.GetUserAccountDetails(\"antony.bragg\");\n\nConsole.WriteLine($\"{user.FirstName} {user.LastName}'s locked out status is: {user.LockedOut}\");\n\n// Result: \"Antony Bragg's locked out statis is: False\"\n```     \n\nUnlockAccount(string username)\n\nSupplied account will be unlocked. \n\n```\nuserAccountTasks.UnlockAccount(\"antony.bragg\");\n```\n\nSetUsersPassword(string username, string password) or SetUsersPassword(string username, string password, bool expireNow) \n\nSupplying a username and a new password will reset the users password.  If no bool is supplied as a third property the account password will not be immedietly expired, if true is supplied the account password will be reset and expired forcing the user to set a new password at log on.\n\n```\nuserAccountTasks.SetUsersPassword(\"antony.bragg\", \"DemoPassword123\"); // Resets password\nuserAccountTasks.SetUsersPassword(\"antony.bragg\", \"DemoPassword123\", true); // Resets password and expires password\n\n```\n\nMoveToOrganisationalUnit(string username, string newOrganisationalUnit)\n\nThe supplied user account will be moved to the given organisational unit if it exists.  The organisational unit's distinguised name is required.\n\n```\nuserAccountTasks.MoveToOrganisationalUnit(\"antony.bragg\", \"OU=Disabled Accounts,DC=gen2training,DC=co,DC=uk\");\n```\nGetLastLogOn(string username)\n\nNot recommended for use yet.\n\nGetThumbnailPhoto(string username)\n\nReturns the users thumbnail photo in a byte format.  In the next version of the software this will be exportable in a range of formats.\n\n```\nvar photo = userAccountTasks.GetThumbnailPhoto(\"antony.bragg\");\n```\n\n### Group Account Tasks\n\nCreating an instance of the GroupAccountTasks class.\n\n```\nvar groupAccountTasks = new GroupAccountTasks();\n```\n\nRemoveUserFromGroup(string username, string groupName)\n\n```\ngroupAccountTasks.RemoveUserFromGroup(\"antony.bragg\", \"Domain Admins\");\n```\n\nAddUsertoGroup(string username, string groupName)\n\n```\ngroupAccountTasks.AddUsertoGroup(\"antony.bragg\", \"Domain Admins\");\n```\n\nGetGroupMembers(string groupName)\n\n```\nvar membersOfGroup = groupAccountTasks.GetGroupMembers(\"Domain Admins\");\n\nforeach (var user in membersOfGroup)\n{\n    Console.WriteLine($\"{user.FirstName} {user.LastName}\");\n}\n```\n\nGetGroupDetails(string groupName)\n\n```\nvar group = groupAccountTasks.GetGroupDetails(\"Domain Admins\");\n            \nConsole.WriteLine(group.Name);\nConsole.WriteLine(group.Description);\nforeach (var user in group.GroupMembers)\n{\n                Console.WriteLine($\"{user.Username}\");\n}\n```\n\n### Prerequisites\n\n[.NET 3.5 or above](https://www.microsoft.com/net/download/dotnet-framework-runtime)\n\n### Installing\n\nInstallation from NuGet - [Package on Nuget](https://www.nuget.org/packages/CaptainQwerty.ActiveDirectoryEasyAPI/)\n\n```\nPM\u003e Install-Package CaptainQwerty.ActiveDirectoryEasyAPI -Version 1.0.0\n```\n\n## Authors\n\n* **[captainqwerty](https://github.com/captainqwerty)** - *Initial work*\n\n## Acknowledgements\n\n* Icon made by [Freepik](https://www.freepik.com/) from [www.flaticon.com](https://www.flaticon.com) and is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaptainqwerty%2Factivedirectoryeasyapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaptainqwerty%2Factivedirectoryeasyapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaptainqwerty%2Factivedirectoryeasyapi/lists"}