Question

Join Workstatins to Domain

  • 19 September 2022
  • 4 replies
  • 260 views

Userlevel 2
Badge

Is it possible to create a worklet that will join a workstation to a corperate domain?  Has anyone attempted this before?


4 replies

This should be possible using the Add-Computer command and leveraging parameters like
-DomainName
-Credential
-LocalCredential
and -OUPath.
(MS Reference)

Badge

Was anyone able to do this successfully through Automox?  If so, could you share the script?

Userlevel 1
Badge

This would be very helpful command

Userlevel 1
Badge

This may work.

 

# Define variables
$domain = "yourdomain.com"
$username = "administrator"
$password = "YourPassword"
$computerName = "YourComputerName"

# Securely convert password to a secure string
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force

# Create credentials object
$credentials = New-Object System.Management.Automation.PSCredential($username, $securePassword)

# Join the computer to the domain
Add-Computer -DomainName $domain -Credential $credentials -ComputerName $computerName -Restart
 

 

Reply