Create Bulk Organizational Units (OU) in Active Directory with PowerShell

Create Bulk Organizational Units (OU) in Active Directory with PowerShell

Source Link is here: https://activedirectorypro.com/create-bulk-organizational-units-ou-in-active-directory-with-powershell/

September 22, 2021 by Robert Allen

In this guide, I’m going to show you how to create bulk OUs in Active Directory using PowerShell. 

Maybe you are migrating to a new domain, server, merging with another company, or creating a lab environment. Whatever the case PowerShell can be used to quickly create a bunch of OUs and save you time. 

Let’s get started. 

The New-ADOrganizationalUnit command

The New-ADOrganizationalUnit cmdlet creates an Active Directory organizational unit (OU). 

Here is an example:

The command below will create the OU “ADPRO Users” under the path DC=ad,DC=activedirectorypro,DC=com

New-ADOrganizationalUnit -Name "ADPRO Users" -Path "DC=ad,DC=activedirectorypro,DC=com"

Before I run the command here is a screenshot of Active Directory, you can see ADPRO Users do not exist. 

Now Open PowerShell ISE and run the command. 

Refresh AD and the OU is now there. 

That was an example of creating a single OU with PowerShell. Now let’s look at how to create a bunch of OUs. 

Step 1: Create a CSV file with a name and path header. 

Step 2: Add the OU names under the name column and the path to where you want them created in AD. 

In the above screenshot, I’m going to create several OUs (Marketing, HR, IT, and so on) in the ADPro Users OU. 

The path is the distinguishedName of the OU. To find this go to the OU, right-click, select properties, then select the attribute editor. 

Step 3: Save the CSV

You can save it anywhere you want. 

Step 4:  Copy and Pase the script below into PowerShell ISE

# This script is used for creating bulk organizational units.

# Import active directory module for running AD cmdlets
Import-Module activedirectory

#Store the data from the CSV in the $ADOU variable.
$ADOU = Import-csv C:\it\ou.csv

#Loop through each row containing user details in the CSV file
foreach ($ou in $ADou)
{
#Read data from each field in each row and assign the data to a variable as below

$name = $ou.name
$path = $ou.path

#Account will be created in the OU provided by the $OU variable read from the CSV file
New-ADOrganizationalUnit `
-Name $name `
-path $path `

}

Modify line #7 and update the path to your CSV. I called my CSV ou.csv and saved it to the c:\it folder so my line 7 looks like this. 

Step 5. Run the script

Click the “run script” button to run the script. 

Refresh AD and you should see the newly created OUs. 

Conclusion

In this guide, I showed you how to create a single OU and how to create bulk OUs by using the New-ADOrganizationalUnit cmdlet. I use this script to quickly rebuild my lab environment. I do a lot of testing in Active Directory so I often need to rebuild it from scratch to test new builds of the ad pro toolkit. This script helps to simplify the rebuild process of AD. 

Top 3 Free Remote Desktop Connections Manager

Top 3 Free Remote Desktop Connections Manager

Top 3 Free Remote Desktop Connections Manager

this article taken from: https://www.nextofwindows.com/top-3-free-remote-desktop-connections-manager 

Remote Desktop Protocol (RDP), developed originally by Microsoft, is a network protocol that provides a way for people to get access to a computer remotely with a nice lightweight user interface along with input devices like keyboard and mouse. Both Windows 7 and 8 come with a native Remote Desktop Client that lets you connect to the remote machine through this protocol. However, for people who constantly need to manage multiple machines at once, you will need a program that manages multiple connections for you to make your life easier. And here are 3 of them that are free and great for you to consider.

Remote Desktop Manager

Remote Desktop Manager - Dashboard

It’s a feature-rich remote connections manager that manages not only multiple remote desktop connections but many other protocols like VNC, Citrix, HTTP, FTP, LogMeIn, TeamViewer, Putty, etc.. You can save credentials locally in the database protected by the AES encryption, or in the external applications like LastPass or KeePass, or on their new released Devolutions Online Database.

What’s good about this tool is that it also supports and integrates pretty well with many popular services as well. Such as:

  • Intel AMT support – to allow remote console asset access even when the computers are off.
  • Hyper-V dashboard – to manager hyper-v powered VMs.
  • Windows PowerShell support
  • Advanced Data Source support, including Amazon S3, Dropbox, FTP, SQL Server, etc..
  • Integrated password manager
  • Microsoft Azure Console
  • Many VPN connections
  • etc..

If you are looking for one that is not only managing remote desktop connections but also many other things, this Remote Desktop Manager could be your answer. The Standard edition is FREE, and according to this comparison sheet, it could just be good enough for most of your IT tasks.

Please also check out our full review of the product here.

Terminals

Terminals

Terminals is another feature rich, tab-based remote desktop clients manager that uses Terminal Services Active Client (mstscax.dll). Other than RDP connections, Terminals can also manage most of other popular connections as well, such as VNC, Console, SSH, VRRC, Citrix, RAS, HTTP, etc.. As a bonus, it also handles a variety of networking operations like Ping, Trace Route, WMI Explorer, TCP Connections, DNS Lookup, Time Sync, etc..

Terminals is an open source project that has been quite actively maintained and developed for some years. It’s on stable version 2 and can be running on Windows XP, Windows 7, and Windows 8. Both 32-bit and 64-bit editions are supported.

Remote Desktop Connection Manager

Remote desktop connection manager

Microsoft itself also offers a manager tool called Remote Desktop Connection Manager 2.7 (RDCMan) that helps you manage multiple remote desktop connections. It’s similar to Windows Servers’ built-in MMC Remote Desktop Snap-in but more flexible.

It works on Windows 7, and server version from 2003 and up. For Windows XP, you will need the latest version of RDP client in order to use it.

/update on Nov. 24, 2014/

The RDCMan 2.7, released on Nov. 11, 2014, is a major feature release. New features include – Virtual machine connect-to-console support – Smart groups – Support for credential encryption with certificates – Windows 8 remote action support – Support for Windows 8, Windows 8.1 / Windows Server 2012, Windows Server 2012 R2

MultiDesk

MultiDesk

MultiDesk is another simple tab-based remote desktop manager that only manages multiple RDP connections for you. All connections can be managed through a server/group folder structure. It’s free and portable. all configurations and connections are saved in the save folder in an XML file. Since it’s portable, you can easily carry it with you so you can get access to it with all the same information.

We actually have reviewed this tool before. Check it out if you want to know more.

That actually made the no. 4 tools I covered here, instead of 3 I intended, but I guess you wouldn’t mind knowing one more option.

RD Tabs

RD Tabs is another tab-based remote desktop manager that not only put Remote Desktop sessions to the tab but also provides extra features such as favorites with advanced editing, command line scripting, connection thumbnails, encrypted passwords, detached connection windows, remote desktop screen capture, remote terminal server information/management, RDP 6.0 support, etc. As one of our lovely commenters, Samuel Davis, states, it’s simple as hell.

Remote Desktop Manager - RD Tabs

/update on Nov. 28, 2014/

2 new additions were mentioned by one of our visitors, mRemoteNG, and 2x Clients. Since they both look pretty good, we are adding them to the list here as below.

mRemoteNG

mRemoteNG is a fork of mRemote, an open source, tabbed, multi-protocol, remote connections manager. It supports not only RDP protocols but also some of the other popular ones as well, including VNC, ICA, SSH, Telnet, etc. It’s a simple program to use and manage all your remote desktop connections from a central location.

mRemoteNG - confCons.xml - 2014-11-28 10_38_26

2x Client

I actually have been using 2x Client for quite a while, not on my main Windows desktop but on my mobile smartphones. I don’t feel its Windows Client offering more compelling features than the ones I mentioned above, but they do have a wide range coverage on other platforms, Linux, Mac, iOS, Android, Windows Phone, and Chrome App. They even have versions for Windows Embedded Systems.

So if you are looking for one mainly used not on Windows Desktop platform, 2x Client might be the one to go. The user experience on 2x Client is better than Microsoft’s own RDP client on both iOS, Android, and Windows Phones.

Verdict

I personally have used Terminals for years and absolutely like it. It’s rock solid and has everything I wanted. However, the Remote Desktop Manager looks so promising and so powerful. It can be your powerful weapon to cover all your needs within one consolidated environment.

That doesn’t mean you should overlook the other tools we mentioned in this post. Both Microsoft RDCMan and MultiDesk are simple and just work. If you are the guy who doesn’t always fall in love with an all-in-one kind of tool. These two are probably your answer. Besides, if managing Windows Servers via RDP is all you needed, why you need a tool with a bunch of features you will never use?

As for managing a bunch of connections on a mobile platform, both Remote Desktop Manager and RD Client from Microsoft work really well.