troubleshooting Question

script issue with joining a pc to domain

Avatar of Jay Thomas
Jay ThomasFlag for United Kingdom of Great Britain and Northern Ireland asked on
5 Comments1 Solution93 ViewsLast Modified:
Script help
I have a test script I run from on-prem which builds a VM in Azure and then connects to the domain.
I use Login-AzureRmAccount in the script to prompt the user to enter the username and password.

Part of my script also joins the PC to the domain using "add-computer –domainname -Credential AD\adminuser -restart –force and press Enter"
The user is then asked to enter a password.

But, I I'd like to use a service account to get the pc joining the domain. So, I know I can use the above example using the service account service principal, but of course I am asked for a password, which I don't know. I know i'm missing something here at it may well be easy, how can I get around this? Any tips appreciated.
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros