Add a Admin user to Administrators Group

Inspired by:
Michael Mardahl | https://www.iphase.dk
Jordan Russel | http://www.jrsoftware.org/

Sources:
https://www.iphase.dk/local-administrators-on-aad-joined-devices/
http://www.jrsoftware.org/
https://www.exemsi.com/download/

Create a folder named Add_Local_Admin
In Add_Local_Admin create three folders:
_Inno
_Intunewin
Install

Download PSAppDeployToolkit and extract

Copy Toolkit files to Install

Create a Add_Local_Admin.ps1 file and save in Add_Local_Admin\Install\Files

New-LocalUser -Name "Admin" -Description "Admin." -NoPassword
net user Admin PASSWORD123@
wmic useraccount where "Name='Admin'" set PasswordExpires=false
net user "Admin" /PasswordChg:No
Add-LocalGroupMember -Group "Administrators" -Member "Admin"

Change on line 2 PASSWORD123@ to what password you want

Create a Unistall.ps1 file and save in Add_Local_Admin\Install\Files

Edit in the Add_Local_Admin\Install the Deploy-Application.ps1 file

Line: 64 to 76
Add # on line 120
Add # on line 123
Add # on line 160
Add # on line 163
Add below line 140 the script.

Below line 185 add the below code

Making Add_Local_Admin.exe

Download Inno Setup and install the software

Create in Notepad++ a file Add_Local_Admin.iss and save to _Inno folder
Copy and paste the below code

Open Inno Setup Compiler and generate a App id on line 8

Run the script (F9)

Making Add_Local_Admin.intunewin

Create a install.cmd file and save in Add_Local_Admin\_Intunewin

Create a Uninstall.cmd file and save in Add_Local_Admin\_Intunewin

Create a Uninstall.ps1 file and save in Add_Local_Admin_Intunewin

Download IntuneWinAppUtil.exe

Open cmd with admin rights and go to IntuneWinAppUtil.exe

Upload Add_Local_Admin.intunewin

https://portal.azure.com/#blade/Microsoft_Intune_Apps/MainMenu/1/selectedMenuItem/Overview

Microsoft Intune > Client apps > Apps
App type: Windows app (Win32)
Name: Add_Local_Admin
Description: Add a Admin user to Administrators Group
Pubisher: Knowledgebase
Category: Computer management
Display this as a featured app in the Company Portal: Yes or No
Upload a logo
Wait for complete upload
Install command: Install.cmd
Unistall command:  Uninstall.cmd
Install behavior: System
Operating system architecture: 64-bit
Minimum operating system: Windows 10 1607
Detection rules>
Rule type: File
Path: C:\Program Files (x86)\
File or folder: Add_Local_Admin
Detection method: File or folder exists
Associated with a 32-bit app on 64-bit clients: Yes

Assign a group in Assignments