Commands to create AD environment

Install AD Dependencies

Windows Server Datacenter (GUI)

Next and Install.

Windows Server Standard (CLI)

From here https://medium.com/@serkanturan_79203/installing-active-directory-with-powershell-ea48de56088c

Install AD DS (Active Directory Domain Services):

Configure a new Forest:

Verify installation:

Promote Server to Domain Controller (GUI)

Click on "Promote this server to a domain controller":

Domain name: freed-om-corp.com

Install:

The server has been promoted to a Domain Controller, and the authentication is now based in domain.

Users

Configure users, groups, machines...

Get-ADUser (search users)

New-ADUser (add user)

Using the Active Directory Users and Computers from the start-menu and inside a folder or using PowerShell commands:

Set-ADUser (update user info)

Let's update the Email:

Remove-ADUser (remove user)

Unlock-ADAccount (unlock user)

Update credentials

Change DoesNotRequirePreAuth Right

This permission is used in Kerberos and is related to ASREP-Roast attack.

GUI:

Enable "Do not require Kerberos preauthentication":

CLI:

We have a list of valid users:

Does anyone have the DoesNotRequirePreAuth right?

Nop.

Let's activate it...

Again, does anyone have the DoesNotRequirePreAuth right?

Yeah, there is one!

Computers

Add-Computer (add a computer to a domain)

In the new computer we are going to execute:

Or remotely:

It will generate a pop-up to input credentials of a Domain Admin (or if the user is already created in the Domain, we can set the user credentials instead of Administrator).

Move a computer to an OU

Remove-Computer

If doesn't work, do it manually in the local computer:

Group Policy Object (GPO)

Configure Group Policy Object with GUI

Force any particular computer to sync its GPOs

Copy-GPO (copy/duplicate a GPO)

Organization Unit (OU)

Get-ADOrganizationUnit (obtain OUs)

Get members of an OU

New-ADOrganizationUnit (create an OU)

Remove-ADOrganizationUnit (remove an OU)

Move-ADObject (to move an object (user, group, etc) to another OU)

Groups

New-ADGroup (create a security group)

  • Security groups: Use to assign permissions to shared resources.

  • Distribution groups: Use to create email distribution lists.

Set-ADGroup (update group info)

Get-ADGroupMember (get members of a group)

Add-ADGroupMember (add members to a group)

Shared Folders

Create a shared folder

GUI:

Check "Type a custom path", and create a folder.

  • Click on "Customize permissions"

  • And set a user with full access (for test) over that folder

Create and we done:

CLI:

And checking:

Last updated