This is a blog post on request. Someone commented on another post (Create Autopilot Profile Powershell) that they would like a script to create a Domain Join Profile in Intune via Powershell.
Some of you need to create more than 10 of these profiles. (Some even more than a 100!)
I thought that was interesting! So, I opened my VS Code to create the script.
You need an account that has enough permissions in Microsoft Intune. Read more about it here.
The script is more than 100 lines. So, I put the script in my GitHub account. This is the link.
You can run the script with the following example code:
$PolicyName = "Windows10_DomainJoin2" $Assignment = "All Users" $ComputernamePrefix = "Win10" $ActiveDirectoryFQDN = "nielskok.tech" $OUname = "OU=Demo,DC=NielsKok,DC=Tech" .\DomainJoinProfile.ps1 -PolicyName $PolicyName -Assignment $Assignment -ComputerNamePrefix $ComputernamePrefix -ActiveDirectoryFQDN $ActiveDirectoryFQDN -OUName $OUname
I will explain the parameters below:
PolicyName –>This is the name that the profile gets in Intune (Displayname)
Assignment –> There are 3 options: “All Users”, “All Devices”, and “Custom group (Fill in Azure AD Group ID)”
ComputernamePrefix –> Prefix for the devices that will be domain joined. After that, a string of 10 random numbers is added to the name. You can change this in the script if you like.
ActiveDirectoryFQDN –> Fully qualified domain name for your Active Directory Domain
OUName –> Organizational Unit where you want to put the machines