Skip to content

Commit 05e19a6

Browse files
committed
Windows 10 Primary User sample additions
1 parent 269fc92 commit 05e19a6

File tree

4 files changed

+1529
-0
lines changed

4 files changed

+1529
-0
lines changed

ManagedDevices/Readme.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,3 +277,91 @@ This function is used to get all managed devices from the Intune Service.
277277
```PowerShell
278278
Get-ManagedDevices
279279
```
280+
281+
### 8. Win10_PrimaryUser_Get.ps1
282+
This script returns the Primary user of an Intune managed Windows 10 device when provided a device name and it will also the Registered Owner and Registered Users on the associated Azure AD device object.
283+
284+
##### Example usage
285+
```
286+
# Gets all win10 devices and outputs Intune Primary User, Registered Owner and Registered User
287+
.\Win10_PrimaryUser_Get.ps1
288+
289+
# Get specific Win10 device and outputs Intune Primary User, Registered Owner and Registered User
290+
.\Win10_PrimaryUser_Get.ps1 -DeviceName c7e9d83a-085e-4886-989b-b4ee1d68c5a4
291+
```
292+
293+
##### Example output
294+
```
295+
Device name: WIN10-01
296+
Intune device id: e774b98b-9e40-457d-a8b1-d396030b01ab
297+
Intune Primary user id: 815f48e9-c108-4524-b9fc-66cf6bbe7b0d
298+
299+
AAD Registered Owner:
300+
Id: 815f48e9-c108-4524-b9fc-66cf6bbe7b0d
301+
Name: Test User
302+
303+
RegisteredUsers:
304+
Id: 815f48e9-c108-4524-b9fc-66cf6bbe7b0d
305+
Name: Test User
306+
```
307+
308+
#### Get-AADDeviceId - Function
309+
This gets an AAD device object id from the Intune AAD device id
310+
```PowerShell
311+
Get-AADDeviceId -deviceId c7e9d83a-085e-4886-989b-b4ee1d68c5a4”
312+
```
313+
314+
#### Get-Win10IntuneManagedDevice – Function
315+
This function is used to return Intune managed Windows 10 devices only
316+
317+
```PowerShell
318+
Get-Win10IntuneManagedDevice -deviceName “DESKTOP-123456”
319+
```
320+
321+
#### Get-IntuneDevicePrimaryUser - Function
322+
This function is used to get an Intune managed device's Primary User
323+
324+
```PowerShell
325+
Get-IntuneDevicePrimaryUser -deviceId c7e9d83a-085e-4886-989b-b4ee1d68c5a4
326+
```
327+
328+
#### Get-AADDevicesRegisteredOwners - Function
329+
This function is used to get the AAD device registered owner when provided the AAD deviceID
330+
331+
```PowerShell
332+
Get-AADDevicesRegisteredOwners -deviceId $aadDeviceId
333+
```
334+
#### Get-AADDevicesRegisteredUsers - Function
335+
This function is used to get the AAD device registered users when provided the AAD deviceID
336+
```PowerShell
337+
Get-AADDevicesRegisteredUsers -deviceId $aadDeviceId
338+
```
339+
340+
### 9. Win10_PrimaryUser_Set.ps1
341+
This script can be used to set an Intune managed Windows 10 device Primary user when provided a device name and User ID.
342+
343+
##### Example usage
344+
```
345+
.\Win10_PrimaryUser_Set.ps1 -DeviceName c7e9d83a-085e-4886-989b-b4ee1d68c5a4 -UserPrincipalName user@tenant.onmicrosoft.com
346+
```
347+
348+
#### Set-IntuneDevicePrimaryUser - Function
349+
This updates the Intune device primary user
350+
```PowerShell
351+
Set-IntuneDevicePrimaryUser -IntuneDeviceId c7e9d83a-085e-4886-989b-b4ee1d68c5a4 -userId 5f801fed-661e-4f43-8dd5-9ff034047307
352+
```
353+
354+
### 10. Win10_PrimaryUser_Delete.ps1
355+
This script can be used to remove the primary user from an Intune managed Windows 10 device.
356+
357+
##### Example usage
358+
```
359+
.\Win10_PrimaryUser_Delete.ps1 -DeviceName c7e9d83a-085e-4886-989b-b4ee1d68c5a4
360+
```
361+
362+
#### Delete-IntuneDevicePrimaryUser - Function
363+
This function deletes the Intune device primary user when provided a DeviceID
364+
365+
```PowerShell
366+
Delete-IntuneDevicePrimaryUser -IntuneDeviceId c7e9d83a-085e-4886-989b-b4ee1d68c5a4”
367+
```

0 commit comments

Comments
 (0)