Questions tagged [active-directory]

Active Directory (AD) is a directory service created by Microsoft. It stores all information and settings for a deployment in a central database. AD allows administrators to assign policies, deploy and update software. AD networks can vary from a small installation with a few computers, users and printers to tens of thousands of users, many different network domains and large server farms spanning many geographical locations.

Filter by
Sorted by
Tagged with
1 vote
2 answers
136 views

Parse list of UserPrincipal objects into custom class

I'm wondering how I could optimize this method that takes in a list of UserPrincipal objects, filters them by Regex and inserts the new class instance into a list. It takes 4 to 5 seconds for an input ...
mvi2110's user avatar
  • 11
0 votes
1 answer
79 views

PowerShell function for provisioning a new Active Directory user

I created a function for creating a new user in AD, assigning an o360 license and enabling mailbox, however, my code is very chaotic and I do not have a much experience with PowerShell. Could you ...
Alex Karapetian's user avatar
0 votes
1 answer
285 views

powershell script for creating a Domain Controller

I don't have a lot of experience creating/managing an active directory environment. This will be more of a lab environment where a solution could be tested. It will not have lots of regular users etc, ...
whoami's user avatar
  • 175
3 votes
0 answers
211 views

Get specific properties for all Active Directory groups and all their users, then combine them into CSV

I've written a script that gets a list of all groups in AD along with a few specific properties for each group (DistinguishedName, CN, Type, and Description). Then it goes through each group and, for ...
TylerH's user avatar
  • 131
3 votes
0 answers
277 views

Update AD Group based on CSV File

I have an AD Group I keep up-to-date based on a CSV file. Users not present in the file should be removed from the AD Group. ...
Peter9001's user avatar
1 vote
0 answers
52 views

Handle login method with external users and LDAP users

I'm working with a ASP.NET Core (v2.2) Web Api project and implemented some APIs. However, I'm facing performance issues, hence trying to optimizing the code. Here is the login API code. ...
Div's user avatar
  • 111
1 vote
1 answer
3k views

scan activedirectory for all users and their groups in domain with c# [closed]

I wrote a method for a wpf app in .net core to get all users and their group by name if they are in a group from my active directory domaine. ...
CamelCase's user avatar
1 vote
2 answers
209 views

Async Check for Domain Fullname With WPF and Caliburn.Micro

I have a small WPF program built using Caliburn.Micro which checks Active Directory for a user with the current username of the logged-on user. I have a Bootstrapper...
I.T Delinquent's user avatar
4 votes
1 answer
3k views

Checks if user is part of Active Directory group

I'm working in C# using PrincipalContext to do a check if user is part of security group for access to the site. Site is asp.net MVC and part of an internal network with security groups set up via ...
EarthBound's user avatar
3 votes
2 answers
137 views

PowerShell script creates a computer list from an AD OU, and add exclusions to a specific file via Invoke-Command

My code is working, however, in the foreach section, when it runs the invoke-command if I don't use "-ErrorAction SilentlyContinue" the red error text that states a computer cannot be connected to ...
xerxes2985's user avatar
2 votes
1 answer
347 views

Active Directory security groups Search application optimization

I have a Web API method that returns the Active Directory security groups for the specific login user. The below code was working fine but it was taking so munch time nearly 45 sec to get the results....
TARUN's user avatar
  • 121
4 votes
1 answer
1k views

Getting Windows User Info From The Active Directory

I took some boilerplate code that I have been using for determining an active windows user's info to either send emails with their details, or to pass to a error logging class, and encapsulated it in ...
rickmanalexander's user avatar
0 votes
1 answer
316 views

Bindling User details from AD using LDAP

I have got a request from a client to fetch all client user details from AD and finally dump to a db so that they can use it for reporting. I have used ...
TheSacredKiller's user avatar
2 votes
1 answer
1k views

Retrieving data from active directory with PHP

I have the following php function, that reads and returns data from the active directory. It is part of a project which will be graded (I'm in an apprenticeship). It is very long and I think the code ...
NicolasB's user avatar
  • 143
1 vote
0 answers
1k views

Leavers Script to disable users in AD, Remove Groups, delete profile and move home folders

i am pretty new to powershell and im not great at coding, but i have managed to cobble together code from around the net to help save time when removing old students accounts in AD. Code currently ...
Karl Hardy's user avatar
2 votes
1 answer
128 views

Powershell script to remove old student accounts from ActiveDirectory

I am pretty new to powershell and I'm not great at coding, but I have managed to cobble together code from around the net to help save time when removing old students accounts in AD. Code currently ...
Karl Hardy's user avatar
2 votes
2 answers
2k views

Powershell script that updates Active Directory user information

I wrote this Powershell script years ago for updating AD from a CSV file. I'd like to try to optimize to run quicker and be more efficient... but I'm not sure where to start / what could improve it. ...
Jarrod's user avatar
  • 21
2 votes
0 answers
8k views

Active Directory: Retrieve all group members using DirectoryServices

I have written a function that will retrieve all active directory group members via DirectoryServices. I am using ...
J Weezy's user avatar
  • 121
2 votes
1 answer
4k views

Member management of Active Directory groups via an ASP.NET MVC website

Background One of the projects I'm working on is an Intranet website which is a front-end for several kinds of data, each aimed at a different set of users. Access to the website is handled through ...
BCdotWEB's user avatar
  • 11.2k
2 votes
2 answers
155 views

Pulling data from a CSV and populate AD

I've been piecing this together little by little for a little over a week. I'm curious if there's a cleaner way to accomplish what this is doing. Basically, it's pulling data from a CSV, creating ...
RKillcrazy's user avatar
2 votes
0 answers
42 views

Updating AD groups for students in each grade level

I have a bunch of groups that contain a nested group. Example: group "DElA 12th Grade" < currently contains group "Helena Class of 2018" group "DELA 11th Grade" < currently contains ...
Darrell Johnson's user avatar
2 votes
1 answer
105 views

Get all AD groups and Exchange features of users

We have about 15000 users and 1000 groups in AD. I have been getting of all AD groups of all AD users and their Exchange features via script like below. But now I have been waiting for more than 3 ...
Cell-o's user avatar
  • 295
2 votes
1 answer
1k views

VBs to query AD

I'm trying to get authentication with AD and to do this I've already made this code. Can anyone provide me if it's correct or not to do this or if I have a better solution. ...
Franco Papalardo's user avatar
2 votes
1 answer
204 views

Inefficient PowerShell function for checking group membership

I use the following function in a PowerShell script to check and - depending on the value of the $Action - either add or remove an Active Directory User Object from ...
George's user avatar
  • 23
3 votes
1 answer
2k views

Retrieving a thumbnail photo for an ActiveDirectory account

I have the following method and I would like to understand how it could be reorganized to be more unit-testable. I think the section about binding to Active Directory could go to its own method, ...
Paul Duer's user avatar
  • 131
1 vote
2 answers
111 views

Code Behind to manage AD users for a CRM system

I have big class in ASP.NET WebForms (legacy). I use VS 2012. I want to evaluate Conditions and execute Actions - Commands like: Create in AD Delete in AD Enable in CRM DesEnable in ...
Kiquenet's user avatar
  • 261
7 votes
2 answers
811 views

Get users from groups in active directory, disposing of everything

I am trying to get active directory groups with their users, all while disposing of all IDisposable assets when they reach the end of their usefulness. The groups ...
Michael Brandon Morris's user avatar
4 votes
1 answer
5k views

Wrapper for ActiveDirectory UserPrincipal and DirectoryEntry

After much frustration and leaked memory from working with UserPrincipals and DirectoryEntrys, I have made a wrapper to get the ...
Michael Brandon Morris's user avatar
7 votes
1 answer
120 views

Query - Instance of query run on ActiveDirectory

This class represents a single query on an Active Directory. It is given the type of query to run and the types of data to return, and performs the query and returns the data when it is commanded to ...
Michael Brandon Morris's user avatar
2 votes
1 answer
825 views

Extension methods to get direct reports from user

I have created a few extension methods to get the direct reports of a UserPrincipal as UserPrincipals themselves. This saves the ...
Michael Brandon Morris's user avatar
5 votes
2 answers
5k views

LDAP Login Script

This is my first time ever having code peer reviewed! This is just the main function I'm concerned about. Edit Apologies for the initial vagueness of my question, this is the "login" part of my ...
Dan's user avatar
  • 520
4 votes
1 answer
119 views

Many similar ViewModel methods to fetch and prepare model data

I have a MVVM application that fetches data from active directory and displays it in a DataGrid. The exact data displayed is determined by which query a user runs, ...
Michael Brandon Morris's user avatar
4 votes
1 answer
2k views

Active Directory Tool - Wpf application to query active directory and display results 2 (UI)

This is an update from here. I have made some changes, and have decided to only include the UI side of things in this particular question. I wanted to make the application follow the MVVM pattern, but ...
Michael Brandon Morris's user avatar
7 votes
1 answer
3k views

Active Directory Tool - WPF application to query active directory and display results

This is a Windows Presentation Foundation application that queries active directory and can display lists of users, users by group, groups, and users by manager (direct reports). It operates on ...
Michael Brandon Morris's user avatar
1 vote
0 answers
664 views

Active Directory Searcher class/API

This is intended to be a model for an application that queries an Active Directory. It can return IEnumerables of the following: ...
Michael Brandon Morris's user avatar
2 votes
3 answers
194 views

Automating New User Creation With C# Web Service

I created a web service which can be called from a form to add new users to the system. The final service will add users to Active Directory and Exchange in the required format (please note that ...
Bassie's user avatar
  • 559
2 votes
2 answers
3k views

Adding some properties to an Active Directory user

I was writing the below section of code which adds some user properties to an Active Directory user, and got wondering - surely we can improve the readability of this : ...
Bassie's user avatar
  • 559
7 votes
1 answer
130 views

Building a string representing 50+ ActiveDirectory options

I have a switch statement used to handle options that a user selected (stored in an array). The array is iterated through, and for each element (enum object) in the array, an appropriate action is ...
Michael Brandon Morris's user avatar
3 votes
1 answer
934 views

Active Directory Query Application - Take 2

This is an update to my previous post about my Active Directory Query Application. I have made multiple modifications, and I request some feedback. Summary: This program queries an active directory ...
Michael Brandon Morris's user avatar
3 votes
2 answers
579 views

Active Directory Query Application

This application is designed to query an active directory, and at the moment, performs only two tasks: Save a list of all users to a file. Save a list of all groups that all users are in to a file. ...
Michael Brandon Morris's user avatar
2 votes
1 answer
2k views

Create share folder, AD security group, add descriptions, and apply security to new folder

My goal for this script was to: Create new folder Create AD group FS-TESTSHARE-R Create AD group FS-TESTSHARE-RW Apply both groups to the new share folder Set full read permissions to FS-TESTSHARE-R ...
Shane Johnson's user avatar
5 votes
1 answer
556 views

Create share folder and AD security group and apply security to new folder

I think I'm finally done with my code and was hoping for some pointers. My goal for this script was to: Create new folder Create AD group FS-TESTSHARE-R Create AD group FS-TESTSHARE-RW Apply both ...
Shane Johnson's user avatar
2 votes
2 answers
3k views

A more efficient way of extracting a name from a string?

Here is some code that reads Active Directory to get a person's manager and parses the result for the managers name. It omits the remaining information. I was just wondering if there might be some ...
Matthew Verstraete's user avatar
4 votes
1 answer
4k views

Get AD Users' Latest Last Logon Dates across Multiple DCs

I was recently asked to help our Spanish BU to audit their AD for inactive accounts. Grabbing a script from online I gave them this: https://gallery.technet.microsoft.com/scriptcenter/Get-Active-...
JohnLBevan's user avatar
  • 1,409
5 votes
1 answer
470 views

Find related groups among list of users

I have one of my first PowerShell scripts that will query a list of users in Active Directory. While doing so it will keep a tally in a hashtable that will update for every group increasing it count ...
Matt's user avatar
  • 2,568
5 votes
1 answer
3k views

Query AD and build CSV based on certain user object properties

My question is about code efficiency. I recently had to write a Powershell 3.0 script which had the following criteria: It had to pull all enabled user objects from active directory It had to pull ...
OutOfThisPlanet's user avatar
4 votes
2 answers
2k views

Loading Active Directory users by username and by SID

I have many different methods like ones below, but is there way I could improve them and remove duplicate code ? ...
Mathematics's user avatar
5 votes
1 answer
316 views

Terminating an Active Directory user

I'm writing an AD Termination script for work. I'm new to PowerShell and was wondering if multiple commands within PowerShell switch statement is okay to do: ...
MFonner's user avatar
  • 53
6 votes
2 answers
10k views

Authenticating user/password against Active Directory using ASP.NET Identity

I am trying to learn how to use ASP.NET Identity. My scenario is that I have to authenticate against Active Directory. For that purpose I am trying to use ...
th1rdey3's user avatar
  • 161
7 votes
1 answer
3k views

Active directory password changer

I have written this Active Directory password changer script. Comments and testing is appreciated for things I may have overlooked, since this is my first AD Script. There are two parts: PHP and ...
Werezwolf's user avatar