Skip to content

dilith-lab/ActiveDirectory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ActiveDirectory

Scripts related to Active Directory module

Users

View Reporting CXO

The following PowerShell script can be used to view the reporting CXO of a list of users with UserPrincipalName (UPN) in Active Directory. You can download the script from Github.

ReportingCXO.ps1

PowerShell.exe -ExecutionPolicy Bypass -File .\ReportingCXO.ps1

# Define the CEO's name
$CEOName = "Yara Ayurvie"

# Defind the User List.
$UserList = '.\Users.csv'

By providing,

  • CEOName
  • UserList with UserPrincipalName (UPN). Sample CSV file: Users.csv

it will export CSV file with user email address and corresponding CXO.

Hierarchical organization

Using PowerShell and Active Directory, it determines if users directly report to the CEO or traverse the managerial hierarchy. I have use this UserList for the demonstration.

Hierarchical organization

View Reporting Managers

The following PowerShell script can be used to view the reporting Manager (CXO, CXO-1, CXO-2 etc) of a set of userswith UserPrincipalName (UPN) in Active Directory. You can download the script from Github.

ReportingManager.ps1

PowerShell.exe -ExecutionPolicy Bypass -File .\ReportingManager.ps1

# Define the Direct Reports - Names of CXO, CXO-1, CXO-2
$DirectReports = @("Yara Ayurvie", "Ama Fernando", "Hansani Perera", "Jon Secada", "Dilith Achalan", "Kotlin Segev")

# Defind the User List.
$UserList = '.\Users.csv'

By providing,

  • DirectReports
  • UserList with UserPrincipalName (UPN). Sample CSV file: Users.csv

it will export CSV file with user email address and corresponding Direct Reports - Names of CXO, CXO-1, CXO-2.

Groups

View Active Directory Group Members

The following PowerShell script can be used to view the members of an Active Directory group. You can download the script from Github.

ViewMembers.ps1

PowerShell.exe -ExecutionPolicy Bypass -File .\ViewMembers.ps1 -GroupName SystemAdmin

By providing group name argument -GroupName [group name], it will export a CSV file with group members of that specific group.

Add Active Directory Group Members

The following PowerShell script can be used to add the members to an Active Directory group. You can download the script from Github.

AddMembers.ps1

PowerShell.exe -ExecutionPolicy Bypass -File .\AddMembers.ps1 -GroupName SystemAdmin -FileName .\GroupMembers.csv

By providing group name argument -GroupName [group name] and -FileName [file name], it will add the group members to that specific group.

Remove Active Directory Group Members

The following PowerShell script can be used to remove the members to an Active Directory group. You can download the script from Github.

RemoveMembers.ps1

PowerShell.exe -ExecutionPolicy Bypass -File .\RemoveMembers.ps1 -GroupName SystemAdmin -FileName .\GroupMembers.csv

By providing group name argument -GroupName [group name] and -FileName [file name], it will remove the group members from that specific group.

About

Scripts related to Active Directory

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published