Generate Fake Email Traffic on Test Lab

This article will explore how to generate email traffic in a test environment using a PowerShell script.

In any Exchange environment, it’s crucial to observe email traffic after setting up Exchange services and activating mailboxes for users, as this indicates how well the Exchange server is performing. This is precisely why we integrate Exchange servers into our Active Directory Forest.

In a live organization, real-life scenarios involve users sending emails, attachments, scheduling calendar meetings, and creating tasks. Such activities generate substantial traffic, which is essential for analysing and optimizing Exchange services.

However, in a test environment, we typically have only the Exchange server and a handful of test users, which is insufficient for generating meaningful traffic within the Exchange servers.

  • Sending Email Using PowerShell

To address this challenge and simulate realistic traffic on the Exchange server, I have developed a PowerShell script capable of sending emails to either a Distribution Group or a Dynamic Distribution Group from each mailbox in our test environment.

  • Adding content to the Email body

Simply generating an email is insufficient, as it would lack content and result in a very small email size. To address this issue, I have created a lengthy text file named ‘longtext.txt’ containing various random texts and topics. This text can serve as the body for each email dispatched by the PowerShell script to the group, thereby adding substance to the emails.

  • Automate the PowerShell Script
By integrating the PowerShell script with a text file for the email content, we can automate the process using Windows Task Scheduler. This automation will execute the script at regular intervals, creating a significant volume of email traffic within the Exchange environment. Such a setup is invaluable for testing and enhancing the performance of PowerShell scripts as well as ensuring the robustness of the Exchange server.

 

Download the PowerShell Script and Text file described from this link.
 
I have demonstrated how to use this script and create a task in Windows Task Scheduler in my YouTube video below.
 

 

How To Create OU’s and Nested OU’s in Active Directory

Adding Organizational Units (OUs) in Active Directory using PowerShell is a streamlined process that can save administrators a lot of time, especially when dealing with large environments. Here’s a step-by-step guide to help you get started:

Prerequisites

Before you begin, ensure you have the Active Directory module for Windows PowerShell installed. You can install it via the Remote Server Administration Tools (RSAT) if it’s not already available.

Step-by-Step Guide

  • “Open PowerShell as Administrator”:
    • Right-click on the PowerShell icon and select “Run as Administrator”.
  • “Import the Active Directory Module”:
    • Run the following command to import the Active Directory module:

Import-Module ActiveDirectory

  • “Create a New Organizational Unit”:
    • Use the `New-ADOrganizationalUnit` cmdlet to create a new OU. Here’s a basic example:
New-ADOrganizationalUnit -Name “UserAccounts” -Path “DC=YourDomain,DC=com”

 

    • This command creates an OU named “UserAccounts” in the specified domain path.
  • “Add Additional Attributes”:
    • You can add more attributes to the OU, such as description or protection from accidental deletion:

 

New-ADOrganizationalUnit -Name “UserAccounts” -Path “DC=YourDomain,DC=com” -Description “OU for user accounts” -ProtectedFromAccidentalDeletion $True

 

  • “Creating Nested OUs”:
    • To create nested OUs, specify the path of the parent OU:

 

New-ADOrganizationalUnit -Name “Admins” -Path “OU=UserAccounts,DC=YourDomain,DC=com”

 

  • “Using a Script for Bulk Creation”:
    • For creating multiple OUs, you can use a PowerShell script. Here’s a simple example:
$OUs = @(
@{Name=”HR”; Path=”DC=YourDomain,DC=com”},
@{Name=”IT”; Path=”DC=YourDomain,DC=com”},
@{Name=”Finance”; Path=”DC=YourDomain,DC=com”}
)
foreach ($OU in $OUs) {
New-ADOrganizationalUnit -Name $OU.Name -Path $OU.Path
}

Using PowerShell to manage Active Directory OUs can significantly enhance efficiency and accuracy. By automating these tasks, administrators can focus on more strategic activities, ensuring a well-organized and secure directory structure.

You can also watch the below YouTube video to learn on Adding Bulk Users in Windows Server 2022
 

 

The Excel Sheets and PowerShell scripts discussed on this video can be downloaded from here

Feel free to ask if you need further assistance or have any questions!

 

How to Add Users in Active Directory

Active Directory (AD) is a directory service developed by Microsoft for Windows domain networks. It is an essential tool for managing users, computers, and other resources within a network. Adding users to Active Directory is a fundamental task for IT administrators. Here’s how you can do it:

Prerequisites

  • Ensure you have administrative privileges to add users to Active Directory.
  • Make sure the Active Directory Users and Computers (ADUC) tool is installed on your system.

Steps to Add Users

  • “Open Active Directory Users and Computers (ADUC)”
    • Press `Win + R` to open the Run dialog box.
    • Type `dsa.msc` and press Enter. This will open the ADUC console.
  • “Navigate to the Desired Organizational Unit (OU)”
    • In the ADUC console, expand the domain and navigate to the Organizational Unit (OU) where you want to add the new user.
  • “Create a New User”
    • Right-click on the OU, select `New`, and then click on `User`.
    • This will open the New Object – User wizard.
  • “Enter User Information”
    • In the wizard, enter the following details:
      • “First Name”: The user’s first name.
      • “Last Name”: The user’s last name.
      • “User Logon Name”: The username the user will use to log in.
      • Click `Next` to proceed.
  • “Set the User Password”
    • Enter and confirm the password for the new user.
    • You can also set options such as requiring the user to change the password at the next logon, or preventing the user from changing the password.
    • Click `Next` to continue.
  • “Complete the User Creation”
    • Review the information you have entered.
    • Click `Finish` to create the new user.
  • “Verify the User Account”
    • The new user should now appear in the selected OU.
    • You can double-click the user account to view and edit additional properties if needed.

 

Additional Tips

“Group Membership”: After creating the user, you may want to add them to specific groups to grant appropriate permissions.
“Profile Settings”: Configure user profile settings such as home directory and profile path if required.
“Account Options”: Set account options like expiration dates or logon hours if needed.

By following these steps, you can efficiently add new users to your Active Directory, ensuring they have the necessary access and permissions to perform their tasks.

You can also watch the below YouTube video to learn on Adding Bulk Users in Windows Server 2022
 

 

 

Below is the cmdlet to create an account from this sheet.

New-ADUser -Enabled $True -PasswordNeverExpires $True -SamAccountName “Alexis.David” -UserPrincipalName “Alexis.David@PS.Local” -Name “Alexis David” -GivenName “Alexis” -Surname “David” -DisplayName “Alexis David” -Path “OU=Users,OU=Human Resources,OU=PS,DC=PS,DC=local” -City Bengaluru -PostalCode 560079 -Country ‘IN’ -Company PS -State Karnataka -MobilePhone “080-2345 6789” -OfficePhone “080-2345 6789” -Division “Human Resources” -Title “HR administrator” -Department “Human Resources” -AccountPassword (ConvertTo-secureString “Welcome!”  -AsPlainText -Force) -ChangePasswordAtLogon $False
The Excel Sheets and PowerShell scripts discussed on this video can be downloaded from here

Feel free to ask if you need further assistance or have any questions!

#iguru_soc_icon_wrap_67fd095936a71 a{ background: transparent; }#iguru_soc_icon_wrap_67fd095936a71 a:hover{ background: transparent; border-color: #661D92; }#iguru_soc_icon_wrap_67fd095936a71 a{ color: #F8F3D9; }#iguru_soc_icon_wrap_67fd095936a71 a:hover{ color: #F8F3D9; }.iguru_module_social #soc_icon_67fd095936a9d1{ color: #FF005D; }.iguru_module_social #soc_icon_67fd095936a9d1:hover{ color: #FF005D; }.iguru_module_social #soc_icon_67fd095936a9d1{ background: #661D92; }.iguru_module_social #soc_icon_67fd095936a9d1:hover{ background: #661D92; }#wgl-menu-module_67fd095936d33 a.wgl-menu-module_link { color: #FFFFFF; font-size: 14px; }#wgl-menu-module_67fd095936d33 a.wgl-menu-module_link:hover { color: #FAF4D3; }#wgl-menu-module_67fd095936d33 a:before { background-color: #FAF4D3; }#wgl-menu-module_67fd095936d93 a.wgl-menu-module_link { color: #FFFFFF; font-size: 14px; }#wgl-menu-module_67fd095936d93 a.wgl-menu-module_link:hover { color: #FAF4D3; }#wgl-menu-module_67fd095936d93 a:before { background-color: #FAF4D3; }#wgl-menu-module_67fd095936df3 a.wgl-menu-module_link { color: #FFFFFF; font-size: 14px; }#wgl-menu-module_67fd095936df3 a.wgl-menu-module_link:hover { color: #FAF4D3; }#wgl-menu-module_67fd095936df3 a:before { background-color: #FAF4D3; }#wgl-menu-module_67fd095936e3f a.wgl-menu-module_link { color: #FFFFFF; font-size: 14px; }#wgl-menu-module_67fd095936e3f a.wgl-menu-module_link:hover { color: #FAF4D3; }#wgl-menu-module_67fd095936e3f a:before { background-color: #FAF4D3; }