Script to Add a Computer to Our Domain Is Failing

Viewed 55

I am just trying out Powershell scripting for the first time and am having a hard time figuring out the issue with a script that is failing when adding a computer to our domain. The majority of the script is pulled from a functional one we already use in our environment, and I modified it to change the name of the computer when adding it. Here is the relevant code:

$DeptName = "JACCSV"

$NewName = $DeptName + $($env:computername)

Add-Computer -Domain "notareal.domain" -Credential $joinCred -NewName $NewName -Restart

Edit: After more testing, the script works if it is run in an elevated powershell instance, but I am unsure why this doesn't work when pushed from Altiris, while our other script to add to our domain does.

0 Answers
Related