windows.domain_controller

This model component provides functionality for managing a Windows domain controller. It includes methods for setting up a domain controller, adding and managing users and groups, configuring organizational units (OUs), and establishing trust relationships with remote forests.

The following VM resources are provided with this model component:

  1. join_windows_domain.ps1 - Joins a Windows machine to a specified domain.

  2. install_domain_controller.ps1 - Installs and configures a domain controller on a Windows Server VM.

  3. change_password.ps1 - Changes the password for a specified user.

  4. add_activedirectory_users.ps1 - Adds or updates Active Directory users.

  5. add_OU.ps1 - Adds an Organizational Unit (OU) to Active Directory.

  6. add_ad_group.ps1 - Adds a group to Active Directory.

  7. add_ad_user_to_group.ps1 - Adds a user to a group in Active Directory.

  8. add_domain_site_subnet.ps1 - Adds a replication site and subnet to Active Directory.

  9. add_users_to_adgroup.ps1 - Adds users to an Active Directory group.

  10. create_bidirectional_trust.ps1 - Adds a bidirectional trust relationship with a remote forest.

  11. create_conditional_forwarder.bat - Adds a conditional forwarder to the DNS server.

  12. join_child_windows_domain.ps1 - Joins a child domain to the domain controller.

  13. move_ad_objects.ps1 - Moves Active Directory objects to a different Organizational Unit (OU).

  14. remove_ad_user.ps1 - Removes a user from Active Directory.

  15. remove_domain_site_subnet.ps1 - Removes a replication subnet from Active Directory.

  16. reset_trust.ps1 - Resets the trust relationship with a remote forest.

Available Objects

class windows.domain_controller.DomainController(domain_id, domain_name, netbios_name)[source]

Bases: object

The DomainController class provides functionality for managing a Windows domain controller.

__annotate_func__ = None
__annotations_cache__ = {}
__firstlineno__ = 1
__init__(domain_id, domain_name, netbios_name)[source]

Initialize the Domain Controller.

windows_domain

A dictionary of domain-related properties. These will be used by other model components to connect VMs to the domain controller and ensure proper domain configuration throughout the experiment. Properties in this dictionary include:

  • id - A unique identifier for this domain. This is used only on the graph so we have unambiguous names for client/controller relationships.

  • controller - If set to True, this host will run the

    VM resource to set up a DC.

  • name - The DNS name of the Windows domain to join or control.

  • netbios - The NETBIOS (short, used in usernames, etc.) name for the domain.

    Only valid on domain controllers, should be ignored on other vertices. If not present, will be set to the first group in the DNS domain name (that is, for test.foo.local, the NETBIOS name would be TEST).

Type:

dict

Parameters:
  • domain_id (str) – The domain ID (NetBiosName).

  • domain_name (str) – The domain name (Domain ID).

  • netbios_name (str) – The NetBIOS name.

__static_attributes__ = ('windows_domain',)
add_ad_replication_site(start_time, site, subnet)[source]

Adds a replication site and subnet to Active Directory.

Parameters:
  • start_time (int) – The time at which to run the script.

  • site (str) – The name of the replication site.

  • subnet (str) – The subnet for the replication site.

add_bidirectional_trust(start_time, remote_forest_name, remote_username, remote_password)[source]

Adds a bidirectional trust relationship with a remote forest.

Parameters:
  • start_time (int) – The time at which to run the script.

  • remote_forest_name (str) – The name of the remote forest.

  • remote_username (str) – The username for the remote forest.

  • remote_password (str) – The password for the remote forest.

add_conditional_forwarder(start_time, zone, ip)[source]

Adds a conditional forwarder to the DNS server.

Parameters:
  • start_time (int) – The time at which to run the script.

  • zone (str) – The DNS zone.

  • ip (str) – The IP address of the forwarder.

add_group(start_time=-25, group=None, scope='Global')[source]

Adds a group to Active Directory.

Parameters:
  • start_time (int) – The time at which to run the script. Default is -25.

  • group (str, optional) – The name of the group. Default is None.

  • scope (str) – The scope of the group. Default is “Global”.

add_inbound_trust(start_time, remote_forest_name, remote_username, remote_password)[source]

Adds an inbound trust relationship with a remote forest.

Parameters:
  • start_time (int) – The time at which to run the script.

  • remote_forest_name (str) – The name of the remote forest.

  • remote_username (str) – The username for the remote forest.

  • remote_password (str) – The password for the remote forest.

add_local_bidirectional_trust(start_time, remote_forest_name, trust_password)[source]

Adds a local bidirectional trust relationship with a remote forest.

Parameters:
  • start_time (int) – The time at which to run the script.

  • remote_forest_name (str) – The name of the remote forest.

  • trust_password (str) – The trust password.

add_ou(start_time=-20, name=None, path=None)[source]

Adds an Organizational Unit (OU) to Active Directory.

Parameters:
  • start_time (int) – The time at which to run the script. Default is -20.

  • name (str, optional) – The name of the OU (e.g., “Workstations”). Default is None.

  • path (str, optional) – The path of the OU (e.g., “DC=acme,DC=com”). Default is None.

add_user(username, password)[source]

Adds a user to the domain.

Parameters:
  • username (str) – The username of the user.

  • password (str) – The password of the user.

add_users(users)[source]

Adds multiple users to the domain.

Parameters:

users (list) – A list of dictionaries containing user information.

add_users_to_group(start_time=-23, users=None, group=None)[source]

Adds users to an Active Directory group.

Parameters:
  • start_time (int) – The time at which to run the script. Default is -23.

  • users (list, optional) – A list of usernames to add. Default is None.

  • group (str, optional) – The name of the group. Default is None.

move_ad_objects(start_time, ou_group, endpoints, domain)[source]

Moves Active Directory objects to a different Organizational Unit (OU).

Parameters:
  • start_time (int) – The time at which to run the script.

  • ou_group (str) – The name of the OU group.

  • endpoints (list) – A list of endpoints to move.

  • domain (str) – The domain name.

move_user(start_time, username, group)[source]

Moves a user into a group in Active Directory.

Parameters:
  • start_time (int) – The time at which to run the script.

  • username (str) – The username of the user.

  • group (str) – The name of the group.

remove_ad_replication_subnet(start_time, subnet)[source]

Removes a replication subnet from Active Directory.

Parameters:
  • start_time (int) – The time at which to run the script.

  • subnet (str) – The subnet to remove.

remove_ad_user(start_time, user)[source]

Removes a user from Active Directory.

Parameters:
  • start_time (int) – The time at which to run the script.

  • user (str) – The username of the user to remove.

reset_trust(start_time, local_forest_name, remote_forest_name, remote_username, remote_password)[source]

Resets the trust relationship with a remote forest.

Parameters:
  • start_time (int) – The time at which to run the script.

  • local_forest_name (str) – The name of the local forest.

  • remote_forest_name (str) – The name of the remote forest.

  • remote_username (str) – The username for the remote forest.

  • remote_password (str) – The password for the remote forest.

set_child_domain(start_time, domain_dns_name, dc_ip)[source]

Joins a child domain to the domain controller.

Parameters:
  • start_time (int) – The time at which to run the script.

  • domain_dns_name (str) – The domain DNS name (e.g., company.com).

  • dc_ip (str) – The IP address of the Domain Controller.