You have to show your work for us to try and help.
What you are asking for help on is done every day.
It’s OK to be new to anything. We all have to start somewhere. Yet, you really should spend time getting to know a tool before using it. Especially in production environments, as you could really cause major damage. There are plenty of free / no cost or low cost online videos, courses, book, etc., you can use.
Windows PowerShell Survival Guide
The purpose of this document is to help you to learn more about PowerShell and to be successful in applying it. This document seeks to point to the best content on the web to enable you to reach that goal.
Read the built-in help files fully
# Get parameters, examples, full and Online help for a cmdlet or function
(Get-Command -Name Get-Content).Parameters
Get-help -Name Get-Content -Examples
Get-help -Name Get-Content -Full
Get-help -Name Get-Content -Online
There are tools that will write the Active Directory code for you, already on Windows server.
Active Directory Administrative Center: Getting Started
Active Directory Administrative Center
Step-By-Step: Utilizing PowerShell History Viewer in Windows Server 2012 R2
Reading in a txt / csv file is an intro to PowerShell thing, and done daily by anyone using it. Again, there are tons for resources all over the web showing exactly how to do this. For example, though this is talking about creating users, creating any AD object is the same, for the most part.
Use PowerShell to Read a CSV file and Create Active Directory User Accounts
There are lots of videos on YouTube, Microsoft Virtual Academy, MS Channel9 on PowerShell holistically and some on this very topic, meaning creating AD objects using PowerShell.
There are pre-built scripts in the MS powershelgallery.com for the same.
Bulk import of organizational units from CSV
I had a project where i needed to replicate the OU structure in a dummy test domain for validation of group policy objects (things like mapped drives/printers for groups) I created this script to import the OU structure that I had pulled from our existing AD environment into my
Yet without learning PowerShell, you may not fully understand what and why something is the why it is or works he way it does.
Rule #1 is never run any code, form anyone, that you don’t fully understand the outcomes / impacts of running it. Never do it in a production environment, if you have not done it in a test lab first. If you don’t have a test lab, then use the MS TechNet Virtual Labs to practice.
TechNet Windows Server 2012 Virtual Lab
Reference books you should thoroughly read and reference regularly in your efforts.
Learn Windows PowerShell in a Month of Lunches 3rd Edition
Donald W. Jones (Author), Jeffrey Hicks (Author)
Windows PowerShell Cookbook: The Complete Guide to Scripting Microsoft’s Command Shell 3rd Edition
Lee Holmes (Author)
Windows PowerShell in Action 3rd Edition
by Bruce Payette (Author), Richard Siddaway (Author)
MOC on-demand, if you cannot go in person.