Skip to main content
Question

Join Workstatins to Domain

  • September 19, 2022
  • 5 replies
  • 417 views

Forum|alt.badge.img

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

5 replies

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


Forum|alt.badge.img
  • Rookie
  • June 14, 2023

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


Forum|alt.badge.img

This would be very helpful command


Forum|alt.badge.img
  • Novice
  • February 26, 2024

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
 

 


wes1cosa
  • Novice
  • May 14, 2025

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
 

 

This method works for me if I run the PS code directly on the end point. However, if I try to push it through a worklet it does not seem to work. It does register the Restart command. And ideas?