Is it possible to create a worklet that will join a workstation to a corperate domain? Has anyone attempted this before?
This discussion is archived and closed to replies. Continue it in the Automox Community Slack.
Discuss on SlackIs it possible to create a worklet that will join a workstation to a corperate domain? Has anyone attempted this before?
This discussion is archived and closed to replies. Continue it in the Automox Community Slack.
Discuss on SlackThis should be possible using the Add-Computer command and leveraging parameters like
-DomainName
-Credential
-LocalCredential
and -OUPath.
(MS Reference)
Was anyone able to do this successfully through Automox? If so, could you share the script?
This would be very helpful command
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 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?
Posted by srheins. Replies by RobertE-Automox, Julie Goyen, saman.keyhan, slammert, wes1cosa.