forked from DeploymentResearch/DRFiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating scripts for Microsoft.Graph module v2
Related to DeploymentResearch#38
- Loading branch information
1 parent
b7a646d
commit 641c864
Showing
3 changed files
with
57 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
Scripts/Intune/Update-Win32AppAssignmentsForDO-MgModule.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
# Install the module. (You need admin on the machine.) | ||
# Install-Module Microsoft.Graph.Beta | ||
# Uncomment line 38 to perform updates | ||
Import-Module Microsoft.Graph.Authentication | ||
Import-Module Microsoft.Graph.Beta.Devices.CorporateManagement | ||
$TenantID = "" | ||
$Scopes = @( | ||
"DeviceManagementApps.ReadWrite.All" | ||
) | ||
$Tenant = Connect-MgGraph -TenantId $TenantID -Scopes $Scopes | ||
|
||
$Apps = Get-MgBetaDeviceAppManagementMobileApp -Filter "contains(displayName, 'P2P')" | ||
($Apps | Measure-Object).Count | ||
$Apps | Select-Object displayName | ||
|
||
foreach ($App in $Apps) { | ||
|
||
$assignments = Get-MgBetaDeviceAppManagementMobileAppAssignment -MobileAppId $App.id | ||
Write-Output "Working on: $($App.displayName)" | ||
foreach ($assignment in $assignments) { | ||
# Show info from assignment: | ||
$assignment | ConvertTo-Json -Depth 5 | ||
$body = @{ | ||
"@odata.type" = "microsoft.graph.mobileAppAssignment" | ||
target = @{ | ||
"@odata.type" = "microsoft.graph.allLicensedUsersAssignmentTarget" | ||
} | ||
# Create settings array for DO Foreground setting | ||
settings = @{ | ||
"@odata.type" = "microsoft.graph.win32LobAppAssignmentSettings" | ||
deliveryOptimizationPriority = "Foreground" | ||
} | ||
} | ||
#Update-MgBetaDeviceAppMgtMobileAppAssignment -MobileAppId $App.id -mobileAppAssignmentId $assignment.Id -BodyParameter $body | ||
} | ||
} | ||
|