addcomputer.py
Add new computers to a network
TLDR
Add a computer with a specific name and password
Only set a new password on an existing computer
Delete an existing computer account
Add computer using Kerberos authentication
Add computer via LDAPS (port 636) instead of SAMR (port 445)
Specify exact domain controller when multiple DCs exist
SYNOPSIS
addcomputer.py [options] <computername>
PARAMETERS
-u, --username
AD admin username for authentication
-p, --password
Password for the admin user (use with caution)
-d, --domain
Target Active Directory domain name
--ou
Organizational Unit to place the computer account
-k, --keytab
Generate and use a keytab file for the machine
--no-dns
Skip automatic DNS registration
-v, --verbose
Enable verbose output for debugging
-h, --help
Display usage information
DESCRIPTION
The addcomputer.py script is a Python-based tool primarily used in Linux environments to create and configure a computer account in a Microsoft Active Directory (AD) domain. It automates the process of joining a Linux machine to an AD domain, handling tasks such as generating Kerberos keys, setting up service principal names (SPNs), and updating DNS records if needed.
Typically invoked from the command line, it requires administrative privileges and appropriate credentials. This script is often found in enterprise setups using tools like SSSD, Samba, or realmd for AD integration. It simplifies domain join operations compared to manual net ads join commands, providing better error handling and logging.
Usage involves specifying the computer name, domain, and admin credentials. It's particularly useful in scripted deployments or automation pipelines for provisioning multiple machines. Note that while not part of core Linux distributions, it may be included in packages like adcli or custom Samba toolsets.
CAVEATS
Not a standard Linux utility; likely a custom or package-specific script (e.g., from Samba or adcli extensions). Requires root privileges, Python 3, and AD connectivity. Interactive password prompts may occur if not provided. Potential security risks with plaintext passwords—prefer keytabs.
EXAMPLE USAGE
addcomputer.py -u admin -p secret -d example.com workstation01
Joins 'workstation01' to 'example.com' using admin credentials.
PREREQUISITES
Install Samba, krb5-user, sssd-ad. Ensure time sync with NTP and resolv.conf points to AD DNS.
HISTORY
Emerged around 2010s with growth of Linux-AD integration tools. Associated with Samba 4.x and tools like Likewise Open/AAD. Evolved for better compatibility with modern AD features like secure channel resets.
SEE ALSO
samba-tool(8), net(8), adcli(1), realm(8)


