Only the Primary user should be a local administrator

Mountain Pond 1,576 Reputation points
2023-05-20T15:21:30.84+00:00

Hello,

I write at once what purpose I pursue. The computer is issued to a user with administrator rights, Autopilot is used. But it is necessary that no one except this user and the administrator be a local administrator, and this user is also not an administrator on other devices.

There are several ways that might work.

First way:

  1. In the autopilot policy, allow all users logged in to be administrators by default.
  2. Create a local group "Device Owners" using the Intune Configuration profile.
  3. Create a script that will be executed on the computer, which will somehow be able to find out who the Primary user is on this device and add its ID to the local group ("Device Owners").

I don`t know how can I get Primary user on Device side, without access to Azure AD.

I can of course calculate by the date the profile was created. If the device is explicitly assigned to the user with autopilot, then he is the first who will enter the system. If he logs in first, I can find out who it is by analize when profile was created wih the same script. But I think it's very difficult.

  1. Create a profile that allows local login and remote connection via RDP only for members of the "Device Owners" group

https://jannikreinhard.com/2021/09/24/how-to-restrict-the-login-to-dedicated-users-with-intune/

  1. I can also additionally use Account protection, which will exclude all users from the local administrators group, except for "Device Owners".

Second way:

  1. Make all users default in the Autopilot policy.
  2. Use LAPS to reset the local administrator password and pass the password to the user if he needs privilege escalation
  3. Use Account protection policy to kick out non-administrators if a user is created and add such a user

Third way:

  1. Using Endpoint Privilege Management

How else can this be implemented?

In fact, only the Primary user should be a local administrator, but there are many devices and for each to make an Account protection policy or local login settings, it's too complicated. There will be many policies, this is not the best option.

Option 1 and 2 look the same ugly.

Thank you.

Microsoft Security | Intune | Enrollment
Microsoft Security | Intune | Other
0 comments No comments
{count} votes

Accepted answer
  1. Konstantinos Passadis 19,591 Reputation points MVP
    2023-05-20T18:19:52.3966667+00:00

    Hello @Denis Pasternak !

    Do you like this :

    User's image

    I bet you do !

    GO to this link

    https://jannikreinhard.com/2022/11/13/intune-device-inventory-ui/

    A great solution i believe fits your case! If you cannot make it work ping for assistance

    Remember this solution is custom and not supported by MS! Use it in your own risk !

    I hope this helps!

    Kindly mark the answer as Accepted and Upvote in case it helped!

    Regards


4 additional answers

Sort by: Most helpful
  1. Mountain Pond 1,576 Reputation points
    2023-05-22T10:15:51.88+00:00

    I did the script

    1. Device added to Autopilot
    2. The device will be assigned to a specific user. The first login will be expected from this user.
    3. The device is bound to an autopilot profile that assigns default permissions to all users logging in to that device.
    4. The user receives the device and logs in for the first time.
    5. The device is configured, all policies are applied, and applications are installed.
    6. After entering and further, the script is executed

    6.1 The script finds entries in the registry about which user added the device to Intune.

    6.2 Script, finds in the registry which SID refers to the name of this user

    6.3 Script, adds this SID to the local Administrators group.

     

    As a result, only the user to whom the device was issued will receive administrator rights, any subsequent user will have standard permissions.

    And did other one.

    chrome_lpQC486enf

    Another way

     1. Create an application.

    1. Grant read device list privileges in Intune.
    2. Read the list of users (to get the SID).

     

    The script to execute the request will receive a list of devices and the current owner. Find out its SID and add it to the local administrators group.

    This will allows admin to change the local administrator by assigning the owner of the device from Intune admin center.

    1 person found this answer helpful.

  2. Konstantinos Passadis 19,591 Reputation points MVP
    2023-05-21T11:05:01.73+00:00

    Hello

    What i can think of

    Create Local Device Administrators

    User's image

    Create Scope Tags ( Now this is kind of overkill , cause the way you describe it you need one group for each User...)

    https://learn.microsoft.com/en-us/mem/intune/fundamentals/scope-tags

    Narrow down Intune Policy with Scope Tags

    Another possible way is to use filters

    https://learn.microsoft.com/en-us/mem/intune/fundamentals/filters

    ALSO i found this

    https://www.anoopcnair.com/manage-local-admins-using-intune-group-mgmt/

    Maybe this is more close to your issue ?

    Tell me what you think of this , and whether any of these fits your scenario!

    I hope this helps!

    Kindly mark the answer as Accepted and Upvote in case it helped!

    Regards


  3. Crystal-MSFT 53,991 Reputation points Microsoft External Staff
    2023-05-22T05:30:58.8066667+00:00

    @Denis Pasternak, Thanks for posting in Q&A. Based as I know, when we assign Autopilot profile and configure the "User account type" as Administrator. The user who enrolls the device will be added into Local Administrators group. So you can ask the primary user you want to login the device during the enrollment. After the enrollment finished, other Azure AD user login will only be a standard user on the device.

    https://learn.microsoft.com/en-us/mem/autopilot/profiles

    Meanwhile, for Azure AD joined device, Global Administrator will be added into the local administrators as well by default.

    Hope it can help.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  4. Mountain Pond 1,576 Reputation points
    2023-05-22T10:12:48.5966667+00:00

    I did the script

    1. Device added to Autopilot
    2. The device will be assigned to a specific user. The first login will be expected from this user.
    3. The device is bound to an autopilot profile that assigns default permissions to all users logging in to that device.
    4. The user receives the device and logs in for the first time.
    5. The device is configured, all policies are applied, and applications are installed.
    6. After entering and further, the script is executed

    6.1 The script finds entries in the registry about which user added the device to Intune.

    6.2 Script, finds in the registry which SID refers to the name of this user

    6.3 Script, adds this SID to the local Administrators group.

     

    As a result, only the user to whom the device was issued will receive administrator rights, any subsequent user will have standard permissions.

    And did other one.

    chrome_aCyU1Geygs

    Another way

     1. Create an application.

    1. Grant read device list privileges in Intune.
    2. Read the list of users (to get the SID).

     

    The script to execute the request will receive a list of devices and the current owner. Find out its SID and add it to the local administrators group.

    This will allows admin to change the local administrator by assigning the owner of the device from Intune admin center.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.