can you write a powershell script that I can deploy from a server to azure-join another…
Private research annotation
Sign in to add a private research label or note.
- User
can you write a powershell script that I can deploy from a server to azure-join another windows 10 computer?
- Assistant
Yes, I can provide a PowerShell script that you can use to join another Windows 10 computer to an Azure Active Directory (AAD) domain.
Before you begin, make sure that you have the following information ready:
- The name of the Azure AD domain that you want to join the computer to.
- The username and password of an account with permissions to join computers to the domain.
- The name of the computer that you want to join to the domain.
Here is the PowerShell script:
bash# Define variables $domainName = "<your AAD domain name>" $joinCredential = Get-Credential -Message "Enter the credentials to join the domain" $computerName = "<name of the computer to join>" # Join the computer to the domain Add-Computer -DomainName $domainName -Credential $joinCredential -ComputerName $computerName -Restart