Hey Guys - so I messed up at 14:49 and forgot to include "-surname $user.'Last Name'" after "-GivenName" - please be sure to include that or see my tutorial page for the correct syntax.
When I run your syntax, Account is created as disabled. I have another question, I was able to add the User Logon name, but script did not select my UPN @example.com ... Thanks for your help and good tutorial
I really appreciate this as I am in an AD DS Class for online Bachelors in cyber security and there is absolutely no direction and no instructions and I am new to this part of the IT world. So thank you for the videos and keep them coming.
Just getting into scripting and some of this went over my head, like the brackets towards the end. But honestly for never even writing a script successfully after watching this I was able too, and not just using your files, which I did appreciate for creating the .csv and all the commands and their parameters. I can not thank you enough tools and videos like this are easier for me to digest than trying to read something. I work for a small IT company and we have a client that has ad and all their users were still using one account to login to every machine 🤦♂️🤦♂️ I was not only able to come in and add 30 users in five minutes but was able to set up certain users with roaming profiles as well. Seriously thank you for this. This video really opened up my understanding
I like that idea its awesome and l also one of your student on Udemy Active Directory & Group Policy Labs. You are a good instructor thanks i really appreciate that
great tutorial! Is there any opportunity to get any 1:1 support? I would like to make a few modifications, but honestly, I'm not sure where to start, and my PowerShell knowledge is very beginner. Thanks
Thanks this helped a lot. the only thing is I got an error at the steps starting at 19:05. Where did "Add Groups (csv)" come from? Is that the name of your csv file?
Very helpful, thanks! Subscribed, set notification and reminder! Can you help with 2 things? 1) Daily import from HR Provided DSV -- How to avoid overwriting? 2) If we already have user John Doe (Johns) and hire John Dalton, John Dapper and John Dapplen , how can I automate the login creation to reflect John Dalton =johnda, john dapper = johndap and John Dapplen = johndapp (if login exists, add an additional character to last initial value)
Definitely! I would write a function with a name something like "DoesUserExist" and I would have it return either true or false. Inside of that function you need to run a Get-ADUser command and search for the user you want to create. If you get a result, return true, else return false. When you call the function, if it returns true then you append a number to the user name and rerun the check to see if that user exist. If it does, then you increment the number and check again. For this part you would probably want to use a while loop. Something like while ($UsernameIsInUse) { ... code to increment number on user name ... } Hard to convey over comments - but hopefully this helps.
useful video, but plz how can i create OU's in the same way?? i have been tried for a long time but it has not worked! 😪. I need to create excel.csv file and then i need powershel script to run it
Hello Paul. Thank you for the video really helpful. How would I create exchange mailboxes for the same users once the AD users are created? Do I need to use for each syntax again? Thank you
What I would do is after block at line 55-59 where we add the user to the groups, I would call the "New-MailBox" command. Of course this may require you to run the script from your exchange server assuming you have on-premises. I think it would also be wise to check if the user was actually created first (i.e. not a duplicate username) before creating the mail box or even adding them to the group as you don't want to accidentally add the wrong user to a group or create mailbox for the wrong user. Off the top of my head a try / catch combined with get-aduser would help you accomplish this.
Thank you very much Paul for the reply. So just the “New-Mailbox” command with $Username after that? Can you please provide me with an example command if possible? Thank you again
Definitely refer to the Microsoft docs (link below) but its a long command like the New-ADUser command: docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/new-mailbox?view=exchange-ps#examples .. There are also examples on that page like this: New-Mailbox -UserPrincipalName chris@contoso.com -Alias chris -Database "Mailbox Database 1" -Name ChrisAshton -OrganizationalUnit Users -Password $password -FirstName Chris -LastName Ashton -DisplayName "Chris Ashton" -ResetPasswordOnNextLogon $true
@@pa1089 I did some more looking into this and it appears that the New-MailBox command is not what you want in this scenario. This is because the new-mailbox ALSO creates a new AD user (in our script we already did that) and that is why you saw the $password variable.. So what you actually want is Enable-Mailbox - This command allows you to create mailboxes for existing users who don't have a mailbox yet... docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/enable-mailbox?view=exchange-ps#examples So something like: Enable-Mailbox -identity $UserName
ADUsers : The term 'ADUsers' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:2 char:1 + ADUsers = Import-CSV C:\Users\Administrator\Desktop + ~~~~~~~ + CategoryInfo : ObjectNotFound: (ADUsers:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException Facing this error
Hey - this is for formatting purposes only so it makes it easier to read. More information here: en.wikipedia.org/wiki/Indentation_style#:~:text=In%20computer%20programming%2C%20an%20indentation,recommended%20for%20maximum%20code%20readability.
WriteHost : Le terme «WriteHost» n'est pas reconnu comme nom d'applet de commande, fonction, fichier de script ou programme exécutable. Vérifiez l'orthographe du nom, ou si un chemin d'accès existe, vérifiez que le chemin d'accès est correct et réessayez. Au caractère C:\script3final.ps1:59 : 13 + WriteHost "Added $Username to $_ group" # Log to console + ~~~~~~~~~ + CategoryInfo : ObjectNotFound: (WriteHost:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Hey Guys - so I messed up at 14:49 and forgot to include "-surname $user.'Last Name'" after "-GivenName" - please be sure to include that or see my tutorial page for the correct syntax.
When I run your syntax, Account is created as disabled. I have another question, I was able to add the User Logon name, but script did not select my UPN @example.com ... Thanks for your help and good tutorial
@@marlonmorales951 You have to add -enabled to the end of the command otherwise it will default to creating disabled users. UPN is inferred I belive.
I really appreciate this as I am in an AD DS Class for online Bachelors in cyber security and there is absolutely no direction and no instructions and I am new to this part of the IT world. So thank you for the videos and keep them coming.
Just getting into scripting and some of this went over my head, like the brackets towards the end. But honestly for never even writing a script successfully after watching this I was able too, and not just using your files, which I did appreciate for creating the .csv and all the commands and their parameters.
I can not thank you enough tools and videos like this are easier for me to digest than trying to read something.
I work for a small IT company and we have a client that has ad and all their users were still using one account to login to every machine 🤦♂️🤦♂️
I was not only able to come in and add 30 users in five minutes but was able to set up certain users with roaming profiles as well.
Seriously thank you for this. This video really opened up my understanding
Awesome!! Lol at your story about AD and all the users used a single user account. Fix them up!
I like that idea its awesome and l also one of your student on Udemy Active Directory & Group Policy Labs. You are a good instructor thanks i really appreciate that
great tutorial! Is there any opportunity to get any 1:1 support? I would like to make a few modifications, but honestly, I'm not sure where to start, and my PowerShell knowledge is very beginner. Thanks
Extremely valuable. Thank you for making this kind of content available!
Great content about Power Shell and created users via CSV with PowerShell
Thanks this helped a lot. the only thing is I got an error at the steps starting at 19:05. Where did "Add Groups (csv)" come from? Is that the name of your csv file?
Your presentation skills are very much appreciable. Thanks, buddy!
Very helpful, thanks! Subscribed, set notification and reminder! Can you help with 2 things? 1) Daily import from HR Provided DSV -- How to avoid overwriting? 2) If we already have user John Doe (Johns) and hire John Dalton, John Dapper and John Dapplen , how can I automate the login creation to reflect John Dalton =johnda, john dapper = johndap and John Dapplen = johndapp (if login exists, add an additional character to last initial value)
Definitely! I would write a function with a name something like "DoesUserExist" and I would have it return either true or false. Inside of that function you need to run a Get-ADUser command and search for the user you want to create. If you get a result, return true, else return false.
When you call the function, if it returns true then you append a number to the user name and rerun the check to see if that user exist. If it does, then you increment the number and check again.
For this part you would probably want to use a while loop. Something like while ($UsernameIsInUse) { ... code to increment number on user name ... }
Hard to convey over comments - but hopefully this helps.
Fyi. Csv files with tabs do work. You have to cast it when importing csv. Forgot the syntax. I think its [t`] (letter t and a back tick).
Thanks for this video, really clear and informative. really appreciate it.
useful video, but plz how can i create OU's in the same way?? i have been tried for a long time but it has not worked! 😪.
I need to create excel.csv file and then i need powershel script to run it
How can multiple group memberships be defined/separated in the spreadsheet? With a space, comma, or semicolon?
Hello Paul. Thank you for the video really helpful. How would I create exchange mailboxes for the same users once the AD users are created? Do I need to use for each syntax again? Thank you
What I would do is after block at line 55-59 where we add the user to the groups, I would call the "New-MailBox" command. Of course this may require you to run the script from your exchange server assuming you have on-premises. I think it would also be wise to check if the user was actually created first (i.e. not a duplicate username) before creating the mail box or even adding them to the group as you don't want to accidentally add the wrong user to a group or create mailbox for the wrong user. Off the top of my head a try / catch combined with get-aduser would help you accomplish this.
Thank you very much Paul for the reply. So just the “New-Mailbox” command with $Username after that?
Can you please provide me with an example command if possible?
Thank you again
Definitely refer to the Microsoft docs (link below) but its a long command like the New-ADUser command: docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/new-mailbox?view=exchange-ps#examples .. There are also examples on that page like this:
New-Mailbox -UserPrincipalName chris@contoso.com -Alias chris -Database "Mailbox Database 1" -Name ChrisAshton -OrganizationalUnit Users -Password $password -FirstName Chris -LastName Ashton -DisplayName "Chris Ashton" -ResetPasswordOnNextLogon $true
Thank you I will cross check the documentation too but why would I need to put in password parameter again as it was created earlier?
@@pa1089 I did some more looking into this and it appears that the New-MailBox command is not what you want in this scenario. This is because the new-mailbox ALSO creates a new AD user (in our script we already did that) and that is why you saw the $password variable.. So what you actually want is Enable-Mailbox - This command allows you to create mailboxes for existing users who don't have a mailbox yet...
docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/enable-mailbox?view=exchange-ps#examples
So something like:
Enable-Mailbox -identity $UserName
Thank you so much sir... Please add the vedio same like this for active directory termination
ADUsers : The term 'ADUsers' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:2 char:1
+ ADUsers = Import-CSV C:\Users\Administrator\Desktop
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (ADUsers:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Facing this error
how to get AD user last logon details using csv (in csv username exist)
IF you could explain why you indent certain line and not others
Hey - this is for formatting purposes only so it makes it easier to read. More information here: en.wikipedia.org/wiki/Indentation_style#:~:text=In%20computer%20programming%2C%20an%20indentation,recommended%20for%20maximum%20code%20readability.
Can you do this with Python?
5:20 my $dialog command turns red instead of green and I don't get that list. Instead nothing happens when I press enter.
did you manage to resolve this?
@@honestphiri5011 I have not. Sorry.
it is so complicated out of my head
thank you!
smoothe
Thank. Brooooooo
Sure thing brrrrrrrooooo :D
@@ServerAcademy bro how extract hardware and software details through powershell remotely
Thanks :pray::pray::pray:
WriteHost : Le terme «WriteHost» n'est pas reconnu comme nom d'applet de commande, fonction,
fichier de script ou programme exécutable. Vérifiez l'orthographe du nom, ou si un chemin d'accès
existe, vérifiez que le chemin d'accès est correct et réessayez.
Au caractère C:\script3final.ps1:59 : 13
+ WriteHost "Added $Username to $_ group" # Log to console
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (WriteHost:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException