Automate Active Directory with PowerShell Tutorial 1 : Introduction

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi and welcome to this new powershell tutorial series in this series uh like i've mentioned in my previous tutorials it's going to be focused around a project we're going to be automating active directory with csv files so we're going to go and create the scripts from scratch with the csv file i'll show you how i generated my csv file and then i'll show you a few other things uh basically just how to get the active directory module uh i'm also using the same setup that i've set up in the hyper-v tutorials so i'll be putting a link to those tutorials in the description so make sure in this video i'll just be going over the project so if you want to follow along starting on the next video make sure you follow those two tutorials and you'll get your hyper-v setup and active directory setup and then you'll be able to go along with this if you already have an active directory setup uh then that should be good to go so firstly i just want to go over what we're doing in this project so we're going to be taking a csv file a very simple one at first if you guys want more complicated csv files i definitely don't mind doing a version two of this project but in this employee file we're just going to be working with employee id first name last name a title a department and an office by all means if you have other types of data like manager or another file maybe with like um or other fields in your csv file to give you like the street address you can definitely add these in i'm going to be covering it with just these properties but it's fairly easy based on following the tutorials if you did have additional fields or different fields to change those the other thing that i wanted to go over with you guys is the active directory module uh so right here we actually have the documentation from microsoft so basically the easiest way to get the active directory module is by installing the rsat tools now you can easily come to this article and i'll be putting the link to this article in the description as well it'll tell you how to install the rsat tools if you're using windows 10 once you install the rsat tools you'll be able to do like the get 80 user commandlet fairly easy i'll be running this from a server that has active directory installed so i'm not going to be running this from a pc but if you install if you're running it from a computer that's just connected to the same domain as as your active directory as long as you have the rsat tools installed and you have the permissions uh to interact with active directory you will be able to do so if you have windows 7 you will have to run a commandlet import module active directory in order to get those commandlets in your powershell session but it goes over all that in this documentation uh so definitely feel free to go look at this it'll have a lot of the commandlets we're using i'll show you a few today just as basic commandlets and how i kind of figured out some of the stuff that we're going to be using in our videos in the future and also i used this site here convert csv.com to generate the data i generated a hundred lines and then i just took 10 lines here and i also ended up forgetting to put a department so i added departments in by hand but i could have easily done that through here but this would be random so if you put in some departments they might not match up with the position so i just did it this way and then i added my departments for the 10 users i didn't want to really do a hundred um but by all means at the end of this tutorial series when we have everything working i will show you um with over i'll probably pick over 500 uh lines for a csv file and we're going to run it through and we're going to see how well it works but for our tutorial series when we're just kind of working with some data to easily kind of see what's going on i'll be using a csv file of just 10 lines and i'm going to try and get my git hub up and put that csv file up there for you guys and i'll be posting a link to that in the description as well so you guys can follow along with the same data but by all means creating your own data is very very easy with this website that i'll be putting in the description uh so this is my server here so let me just kind of give a focus here on it so this is my csv file like i said that i'll be working with and i have the active directory already installed and set up with the domain and i am logged in as an administrator as well and my files are located on the c drive under the data share so that's where my file are so when you see me kind of referencing to see data employees that's just because that's where my csv file is so now let's go ahead and let's open up powershell here and let's actually see what we're dealing with with the active directory module so let me just make sure that my code is nice and big for you guys here that should be good you guys should be able to see that all right so a very very standard aed commandlets is going to be the get user commandlet and this you're probably going to use quite a bit so what i'd like to do is just do a get ad user parameter of identity and we're just going to get our jacked user and this is the username the same account name and then we are going to specify a server of jacked we're going to put that in a string here dot ca which that is my domain so if we go back into active directory here we can see that it is my domain name and then we are going to go ahead and we are just going to put a properties star which that tells powershell to get us all the properties for this user and then if we run this we can see that we get a lot of data back so these are all the different properties in active directory now you can actually get even more properties uh to filter but like i said we're not working with like a huge um csv file with lots of different properties but we do see here that we do have a physical delivery office name an office property but we're actually going to be using the physical delivery office name we also have an employee id we have an employee number we have a given name we have a a surname there's the state there's a street address so there's a lot of values that you can set and you could even see these really if we just opened up this user here frederick tucker his office is in new york he's the ceo works at the department of executive office again all these data like all my other all my other videos they're all fictional data none of these people are real if they are real it's really just a luck of the draw and then we can even go so in active directory by default this advanced features isn't checked off go ahead and you're going to want to click on that and that's going to give you a lot more options when you go into a user as long as you're in the proper organizational unit you're going to have this attribute editor which is going to give you all the attributes to an ad account so not only can you look at them through powershell but you can actually look at them directly in active directory which could be pretty handy if you're having some issues and you just want to go in and set something manually by hand you can easily set that up we can edit this employee id if we needed to so that's very handy to know is at least where to go get your properties now some of the other commandlets we'll be using is going to be the set ad user which is basically going to be used to make our changes we also have new ad user which is going to be used to create ad users and then we have a remove ad aduser which is going to be used to delete them but all those can be found in the documentation i'm trying to keep these videos pretty short i'm seeing that i'm approaching in the 10 minute mark all these videos in this tutorial i'm probably going to keep between 10 and 15 minutes just to keep it nice bite-sized pieces and we're going to be breaking down the project into different parts so for right now the first video is this is the introduction uh just kind of telling you guys what we're going to be doing in this project in the next video we're actually going to get right into it we're going to be starting by creating the function which is going to load in our csv data and then in the third video we're going to go and grab data from our active directory and then in the video after that we're going to be comparing those two data sets and so on so it's really going to be showing you how i break problems into smaller problems because automating ad is definitely a big project lots of moving parts and you want to break those moving parts uh into the smallest possible sets this way adding a feature updating a feature really kind of goes really quickly and you're able to get this script working nicely and instead of coding a thousand lines uh and then having to try it out and then finding out that it doesn't work we're going to be making it into chunks of like maybe 40 50 lines at most and we're gonna be always able to run it after each video and see the results and make sure that we're getting the proper output that we want and being able to move on so i definitely want you guys to follow along uh and definitely code alongside with this uh with your own environment just so you can get a really good feel and play around with different properties this is a script that you can use if you are in an i.t department feel free to use it make sure that you do test it in a test environment first just because i'm showing it to you here uh there could always be problems especially with the different types of data like if you're not using csv files or if you are make sure that the quality of the csv data is is good make sure that you actually check it because sometimes if the department that takes care of your employees can give you that data it could be fully correct there might be some duplicate employees they're going to be the best people to really ask to validate that data making sure that all the employees are in there and then just going with your department making sure that they want you to automate this making sure that there's no types of policies or if you guys are already using something like forefront identity management to manage your users you don't really need this but that's a pretty expensive piece of software if you're a small enterprise to be using we're going to be focusing mostly around the user but not really the permissions but definitely in another tutorial i will be showing you guys uh something that i've made already in the past i'm going to be remaking it for you guys in a slightly different way and that's going to be managing everyone's permissions and making sure that their permissions are set uh properly so that's basically it for this video make sure to like and subscribe and click that notification bell um for when these videos come out i'm gonna definitely try to release about three videos a week for this just so you guys can keep moving keep coding uh and i'll see you on the next video
Info
Channel: JackedProgrammer
Views: 1,244
Rating: undefined out of 5
Keywords: powershell, automation, active directory, scripting, programming
Id: e-gHIX67CsY
Channel Id: undefined
Length: 13min 49sec (829 seconds)
Published: Sat May 29 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.