Gagandeep window assignment 5
Gagandeep window assignment 5
Date- 26-03-2025
The first step is creating an OU in which I am going to add users, and for doing that, I login
as an administrator
Logging in as an admin is key when working with Active Directory in PowerShell because it
gives you the special access needed to create, tweak, or delete things like OUs, users, and
groups. If you’re just a regular user, you’d hit a wall with “Access Denied” errors on
admin lets you breeze through tasks like backing up or deleting an OU without hassle. It’s
like real-life IT work—only admins get the keys to the kingdom, so you’re learning the ropes
The next step is choosing the tool option and selecting Active Directory users and computers
Q2. Why I choose Active Directory users and computers?
I choose Active Directory Users and Computers (ADUC) because it’s an easy, visual way to
check PowerShell changes in Active Directory. It shows OUs, users, and groups clearly for
screenshots, like "OU=812" with "User812". It’s admin-friendly and perfect for confirming,
following the above steps, we successfully create an new OU on the name of 812
-SamAccountName $user `
-UserPrincipalName "[email protected]" `
-Path $ouPath `
-Enabled $true
}
This PowerShell script creates three AD user accounts (User812, Admin812, Guest812) in
the "812" OU under the "Gagandeep.com" domain. Each user gets a SAMAccountName,
UPN, and a preset password (P@ssw0rd123). The accounts are immediately enabled upon
$ouPath = "OU=812,DC=Gagandeep,DC=com"
Path $ouPath
This PowerShell command creates a global Active Directory group named "Group812"
"Group812" sets its login identifier, -GroupScope Global defines its scope, and -Path $ouPath
$groupName = "Group812"
}
For checking the members are added to group right click on group name < properties
<member
If I go to the description, there is no description and we find description under general tab
Now, I am going to add description
Ans The command updates the "Group812" AD group's description, providing additional
context (e.g., "Group for student 812") for better organization and clarity.
$ouPath = "OU=812,DC=Gagandeep,DC=com"
$backupPath = "C:\Backup"
}
# Export the OU and its contents
"$backupPath\OU812_Backup.xml"
This PowerShell script backs up the contents of an Active Directory Organizational Unit
(OU). It first checks if the backup directory "C:\Backup" exists and creates it if not. Then, it
retrieves all objects within the "812" OU using Get-ADObject, and exports the data to an
Now looking for backup file I open the file manager < C drive < Backup and here I found the
file
Now, for exporting a file to my original Pc, I just copied it and pasted it to my folder named
Now the last step is removing the Ou and for doing that I am going to run following
command first
$ouPath = "OU=812,DC=Gagandeep,DC=com"
I added this command to disable the protective group policy and after that I used
$ouPath = "OU=812,DC=Gagandeep,DC=com"
And this command deleted the OU successfully as the protection is removed by the previous
command