Upload files to "windows-ad/populate_ad"

This commit is contained in:
Ryan Malloy 2024-11-14 18:18:46 +00:00
parent 7ca369aa9f
commit 66c942f679
6 changed files with 3140 additions and 0 deletions

View File

@ -0,0 +1,24 @@
# website: activedirectorypro.com
Import-Module ActiveDirectory
#Import CSV
$groups = Import-Csv c:\it\groups.csv
# Loop through the CSV
foreach ($group in $groups) {
$groupProps = @{
Name = $group.name
Path = $group.path
GroupScope = $group.scope
GroupCategory = $group.category
Description = $group.description
}#end groupProps
New-ADGroup @groupProps
} #end foreach loop

View File

@ -0,0 +1,24 @@
# This script is used for creating bulk OUs from a CSV file
# Update the CSV with the OU name and path
# website: activedirectorypro.com
# Import active directory module for running AD cmdlets
Import-Module activedirectory
#Store the data from ADUsers.csv in the $ADUsers variable. CSV template needs the following headers-> name, path
$ADOU = Import-csv C:\it\ous.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 `
}

View File

@ -0,0 +1,58 @@
#Import active directory module for running AD cmdlets
#Author: Robert Allen
#Website: activedirectrypro.com
Import-Module activedirectory
#Store the data from ADUsers.csv in the $ADUsers variable
$Users = Import-csv c:\it\users.csv
#Loop through each row containing user details in the CSV file
foreach ($User in $Users) {
# Read user data from each field in each row
# the username is used more often, so to prevent typing, save that in a variable
$Username = $User.SamAccountName
# Check to see if the user already exists in AD
if (Get-ADUser -F {SamAccountName -eq $Username}) {
#If user does exist, give a warning
Write-Warning "A user account with username $Username already exist in Active Directory."
}
else {
# User does not exist then proceed to create the new user account
# create a hashtable for splatting the parameters
$userProps = @{
SamAccountName = $User.SamAccountName
Path = $User.Path
GivenName = $User.GivenName
Surname = $User.Surname
Initials = $User.Initials
Name = $User.Name
DisplayName = $User.DisplayName
UserPrincipalName = $user.UserPrincipalName
Department = $User.Department
Description = $User.Description
Office = $User.Office
OfficePhone = $User.OfficePhone
StreetAddress = $User.StreetAddress
POBox = $User.POBox
City = $User.City
State = $User.State
PostalCode = $User.PostalCode
Title = $User.Title
Company = $User.Company
Country = $User.Country
EmailAddress = $User.Email
AccountPassword = (ConvertTo-SecureString $User.Password -AsPlainText -Force)
Enabled = $true
ChangePasswordAtLogon = $true
} #end userprops
New-ADUser @userProps
# Write-Host "The user account $User is created." -ForegroundColor Cyan
} #end else
}

View File

@ -0,0 +1,21 @@
name,path,scope,category,description
Marketing_local,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
Marketing_Folders,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
Accounting_Printers,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
Accounting_Folders,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
Accounting_Local,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
HR_local,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
HR_Folders,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
IT_Printers,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
IT_Folders,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
IT_Local,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
Management_Printers,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
Management_Folders,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
PR_Printers,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
PR_Folders,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
Operations_Printers,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
Operations_Folders,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
Legal_Printers,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
Legal_Folders,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
Purchasing_Printers,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
Purchasing_Folders,"OU=Mylab Groups,DC=mylab,DC=local",DomainLocal,Security,
1 name path scope category description
2 Marketing_local OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
3 Marketing_Folders OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
4 Accounting_Printers OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
5 Accounting_Folders OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
6 Accounting_Local OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
7 HR_local OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
8 HR_Folders OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
9 IT_Printers OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
10 IT_Folders OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
11 IT_Local OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
12 Management_Printers OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
13 Management_Folders OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
14 PR_Printers OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
15 PR_Folders OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
16 Operations_Printers OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
17 Operations_Folders OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
18 Legal_Printers OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
19 Legal_Folders OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
20 Purchasing_Printers OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security
21 Purchasing_Folders OU=Mylab Groups,DC=mylab,DC=local DomainLocal Security

View File

@ -0,0 +1,22 @@
name,path
Mylab Groups,"DC=mylab, DC=local"
Mylab Users,"DC=mylab, DC=local"
Marketing,"OU=mylab Users,DC=mylab, DC=local"
HR,"OU=mylab Users,DC=mylab, DC=local"
IT,"OU=mylab Users,DC=mylab, DC=local"
Accounting,"OU=mylab Users,DC=mylab, DC=local"
Management,"OU=mylab Users,DC=mylab, DC=local"
PR,"OU=mylab Users,DC=mylab, DC=local"
Operations,"OU=mylab Users,DC=mylab, DC=local"
Legal,"OU=mylab Users,DC=mylab, DC=local"
Purchasing,"OU=mylab Users,DC=mylab, DC=local"
Mylab Computers,"DC=mylab, DC=local"
Marketing,"OU=mylab Computers,DC=mylab, DC=local"
HR,"OU=mylab Computers,DC=mylab, DC=local"
IT,"OU=mylab Computers,DC=mylab, DC=local"
Accounting,"OU=mylab Computers,DC=mylab, DC=local"
Management,"OU=mylab Computers,DC=mylab, DC=local"
PR,"OU=mylab Computers,DC=mylab, DC=local"
Operations,"OU=mylab Computers,DC=mylab, DC=local"
Legal,"OU=mylab Computers,DC=mylab, DC=local"
Purchasing,"OU=mylab Computers,DC=mylab, DC=local"
1 name path
2 Mylab Groups DC=mylab, DC=local
3 Mylab Users DC=mylab, DC=local
4 Marketing OU=mylab Users,DC=mylab, DC=local
5 HR OU=mylab Users,DC=mylab, DC=local
6 IT OU=mylab Users,DC=mylab, DC=local
7 Accounting OU=mylab Users,DC=mylab, DC=local
8 Management OU=mylab Users,DC=mylab, DC=local
9 PR OU=mylab Users,DC=mylab, DC=local
10 Operations OU=mylab Users,DC=mylab, DC=local
11 Legal OU=mylab Users,DC=mylab, DC=local
12 Purchasing OU=mylab Users,DC=mylab, DC=local
13 Mylab Computers DC=mylab, DC=local
14 Marketing OU=mylab Computers,DC=mylab, DC=local
15 HR OU=mylab Computers,DC=mylab, DC=local
16 IT OU=mylab Computers,DC=mylab, DC=local
17 Accounting OU=mylab Computers,DC=mylab, DC=local
18 Management OU=mylab Computers,DC=mylab, DC=local
19 PR OU=mylab Computers,DC=mylab, DC=local
20 Operations OU=mylab Computers,DC=mylab, DC=local
21 Legal OU=mylab Computers,DC=mylab, DC=local
22 Purchasing OU=mylab Computers,DC=mylab, DC=local

File diff suppressed because it is too large Load Diff