Skip to content

Commit

Permalink
1.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
NickolajA committed Mar 7, 2024
1 parent 6c5875b commit 4f2f993
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 20 deletions.
2 changes: 1 addition & 1 deletion IntuneWin32App.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
RootModule = 'IntuneWin32App.psm1'

# Version number of this module.
ModuleVersion = '1.4.3'
ModuleVersion = '1.4.4'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
6 changes: 4 additions & 2 deletions Private/Invoke-AzureStorageBlobUploadChunk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ function Invoke-AzureStorageBlobUploadChunk {
Author: Nickolaj Andersen
Contact: @NickolajA
Created: 2020-01-04
Updated: 2021-04-02
Updated: 2024-01-10
Version history:
1.0.0 - (2020-01-04) Function created
1.0.1 - (2021-04-02) Added UseBasicParsing to support conditions where IE first run experience have not been completed
1.0.2 - (2024-01-10) Fixed issue described in #128 - thanks to @jaspain for finding the solution
#>
param(
[parameter(Mandatory = $true)]
Expand All @@ -35,7 +36,8 @@ function Invoke-AzureStorageBlobUploadChunk {
$Uri = "$($StorageUri)&comp=block&blockid=$($ChunkID)"
$ISOEncoding = [System.Text.Encoding]::GetEncoding("iso-8859-1")
$EncodedBytes = $ISOEncoding.GetString($Bytes)
$Headers = @{
$Headers = @{
"content-type" = "text/plain; charset=iso-8859-1"
"x-ms-blob-type" = "BlockBlob"
}

Expand Down
22 changes: 17 additions & 5 deletions Private/Invoke-Executable.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,28 @@ function Invoke-Executable {

[parameter(Mandatory = $false, HelpMessage = "Specify whether standard output should be redirected.")]
[ValidateNotNull()]
[bool]$RedirectStandardOutput = $true
[bool]$RedirectStandardOutput = $true,

[parameter(Mandatory = $false, HelpMessage = "Specify whether standard error output should be redirected.")]
[ValidateNotNull()]
[bool]$RedirectStandardError = $true,

[parameter(Mandatory = $false, HelpMessage = "Specify whether to create a new window for the executable.")]
[ValidateNotNull()]
[bool]$CreateNoWindow = $true,

[parameter(Mandatory = $false, HelpMessage = "Specify whether to create a new window for the executable.")]
[ValidateNotNull()]
[bool]$UseShellExecute = $false
)
try {
# Create the Process Info object which contains details about the process
$ProcessStartInfoObject = New-object System.Diagnostics.ProcessStartInfo
$ProcessStartInfoObject = New-object -TypeName "System.Diagnostics.ProcessStartInfo"
$ProcessStartInfoObject.FileName = $FilePath
$ProcessStartInfoObject.CreateNoWindow = $true
$ProcessStartInfoObject.UseShellExecute = $false
$ProcessStartInfoObject.CreateNoWindow = $CreateNoWindow
$ProcessStartInfoObject.UseShellExecute = $UseShellExecute
$ProcessStartInfoObject.RedirectStandardOutput = $RedirectStandardOutput
$ProcessStartInfoObject.RedirectStandardError = $true
$ProcessStartInfoObject.RedirectStandardError = $RedirectStandardError

# Add the arguments to the process info object
if ($Arguments.Count -gt 0) {
Expand Down
5 changes: 3 additions & 2 deletions Public/Add-IntuneWin32AppDependency.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ function Add-IntuneWin32AppDependency {
Author: Nickolaj Andersen
Contact: @NickolajA
Created: 2021-08-31
Updated: 2023-09-04
Updated: 2024-01-05
Version history:
1.0.0 - (2021-08-31) Function created
1.0.1 - (2023-09-04) Fixed adding a dependency to not overwrite existing supersedence rules, reported in PR #105 (thank you pvorselaars). Updated with Test-AccessToken function
1.0.2 - (2024-01-05) Fixed a object property construction issue when creating the relationships table #122
#>
[CmdletBinding(SupportsShouldProcess = $true)]
param(
Expand Down Expand Up @@ -64,7 +65,7 @@ function Add-IntuneWin32AppDependency {
# Validate that Win32 app where dependency is configured, is not passed in $Dependency variable to prevent an app depending on itself
if ($Win32AppID -notin $Dependency.targetId) {
$Win32AppRelationshipsTable = [ordered]@{
"relationships" = if ($Supersedence) { @($Dependency; $Supersedence) } else { @($Dependency) }
"relationships" = @(if ($Supersedence) { @($Dependency; $Supersedence) } else { @($Dependency) })
}

try {
Expand Down
6 changes: 3 additions & 3 deletions Public/Add-IntuneWin32AppSupersedence.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ function Add-IntuneWin32AppSupersedence {
Author: Nickolaj Andersen
Contact: @NickolajA
Created: 2021-04-01
Updated: 2023-09-04
Updated: 2024-01-05
Version history:
1.0.0 - (2021-04-01) Function created
1.0.1 - (2021-08-31) Updated to use new authentication header
1.0.1 - (2023-09-04) Fixed adding a dependency to not overwrite existing supersedence rules, reported in PR #105 (thank you pvorselaars). Updated with Test-AccessToken function
1.0.2 - (2024-01-05) Fixed a object property construction issue when creating the relationships table #122
#>
[CmdletBinding(SupportsShouldProcess = $true)]
param(
Expand Down Expand Up @@ -64,9 +65,8 @@ function Add-IntuneWin32AppSupersedence {

# Validate that the target Win32 app where supersedence is to be configured, is not passed in $Supersedence variable to prevent target app superseding itself
if ($Win32AppID -notin $Supersedence.targetId) {
@($Supersedence; $Dependencies)
$Win32AppRelationshipsTable = [ordered]@{
"relationships" = if ($Dependencies) { @($Supersedence; $Dependencies) } else { @($Supersedence) }
"relationships" = @(if ($Dependencies) { @($Supersedence; $Dependencies) } else { @($Supersedence) })
}

try {
Expand Down
25 changes: 24 additions & 1 deletion Public/Get-IntuneWin32AppAssignment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function Get-IntuneWin32AppAssignment {
Author: Nickolaj Andersen
Contact: @NickolajA
Created: 2020-04-29
Updated: 2023-09-04
Updated: 2024-01-05
Version history:
1.0.0 - (2020-04-29) Function created
Expand All @@ -32,6 +32,7 @@ function Get-IntuneWin32AppAssignment {
1.0.4 - (2021-04-01) Updated token expired message to a warning instead of verbose output
1.0.5 - (2021-08-31) Updated to use new authentication header
1.0.6 - (2023-09-04) Updated with Test-AccessToken function. Added new properties in the output of assignments, such as FilterID, FilterType, DeliveryOptimizationPriority, Notifications, RestartSettings and InstallTimeSettings.
1.0.7 - (2024-01-05) Improved the property output from function to include the same properties independent of the parameter set name used
#>
[CmdletBinding(SupportsShouldProcess = $true)]
param(
Expand Down Expand Up @@ -142,6 +143,7 @@ function Get-IntuneWin32AppAssignment {
if ($AzureADGroupResponse.displayName -like "*$($GroupName)*") {
Write-Verbose -Message "Win32 app assignment '$($Win32AppAssignment.id)' for app '$($Win32MobileApp.displayName)' matched group name: $($GroupName)"

# Determine if assignment is either Include or Exclude for GroupMode property output
switch ($Win32AppAssignment.target.'@odata.type') {
"#microsoft.graph.groupAssignmentTarget" {
$GroupMode = "Include"
Expand Down Expand Up @@ -176,11 +178,32 @@ function Get-IntuneWin32AppAssignment {
}
else {
foreach ($Win32AppAssignment in $Win32AppAssignmentResponse.value) {
# Determine if assignment is either Include or Exclude for GroupMode property output
switch ($Win32AppAssignment.target.'@odata.type') {
"#microsoft.graph.groupAssignmentTarget" {
$GroupMode = "Include"
}
"#microsoft.graph.exclusionGroupAssignmentTarget" {
$GroupMode = "Exclude"
}
}

# If data type is of type 'groupAssignmentTarget' then retrieve group name from given group id
if ($Win32AppAssignment.target.'@odata.type' -like '*groupAssignmentTarget') {
$AzureADGroupResponse = Invoke-AzureADGraphRequest -Resource "groups/$($Win32AppAssignment.target.groupId)" -Method "GET"
}
else {
$AzureADGroupResponse = $null
}

# Create a custom object for return value
$PSObject = [PSCustomObject]@{
Type = $Win32AppAssignment.target.'@odata.type'
AppName = $Win32MobileApp.displayName
FilterID = $Win32AppAssignment.target.deviceAndAppManagementAssignmentFilterId
FilterType = $Win32AppAssignment.target.deviceAndAppManagementAssignmentFilterType
GroupID = $Win32AppAssignment.target.groupId
GroupName = if ($AzureADGroupResponse -ne $null) { $AzureADGroupResponse.displayName } else { $null }
Intent = $Win32AppAssignment.intent
GroupMode = $GroupMode
DeliveryOptimizationPriority = $Win32AppAssignment.settings.deliveryOptimizationPriority
Expand Down
5 changes: 3 additions & 2 deletions Public/New-IntuneWin32AppDependency.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ function New-IntuneWin32AppDependency {
Author: Nickolaj Andersen
Contact: @NickolajA
Created: 2021-08-31
Updated: 2023-09-04
Updated: 2024-01-05
Version history:
1.0.0 - (2021-08-31) Function created
1.0.1 - (2023-09-04) Updated with Test-AccessToken function
1.0.2 - (2024-01-05) Fixed a type on the Test-AccessToken function implementation
#>
[CmdletBinding(SupportsShouldProcess = $true)]
param(
Expand All @@ -39,7 +40,7 @@ function New-IntuneWin32AppDependency {
Write-Warning -Message "Authentication token was not found, use Connect-MSIntuneGraph before using this function"; break
}
else {
if (Test-AccessToken -eq $false) {
if ((Test-AccessToken) -eq $false) {
Write-Warning -Message "Existing token found but has expired, use Connect-MSIntuneGraph to request a new authentication token"; break
}
}
Expand Down
2 changes: 1 addition & 1 deletion Public/New-IntuneWin32AppPackage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function New-IntuneWin32AppPackage {
if ($ProcessPackage -eq $true) {
# Invoke IntuneWinAppUtil.exe with parameter inputs
Write-Verbose -Message "Invoking IntuneWinAppUtil.exe to initialize packaging process"
$PackageInvocation = Invoke-Executable -FilePath $IntuneWinAppUtilPath -Arguments "-c ""$($SourceFolder)"" -s ""$($SetupFile)"" -o ""$($OutPutFolder)"" -q" -RedirectStandardOutput $false
$PackageInvocation = Invoke-Executable -FilePath $IntuneWinAppUtilPath -Arguments "-c ""$($SourceFolder)"" -s ""$($SetupFile)"" -o ""$($OutPutFolder)"" -q" -RedirectStandardOutput $false -RedirectStandardError $false -CreateNoWindow $false -UseShellExecute $true
if ($PackageInvocation.ExitCode -eq 0) {
Write-Verbose -Message "IntuneWinAppUtil.exe packaging process completed with exit code $($PackageInvocation.ExitCode)"

Expand Down
3 changes: 2 additions & 1 deletion Public/Remove-IntuneWin32AppDependency.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function Remove-IntuneWin32AppDependency {
Version history:
1.0.0 - (2021-08-31) Function created
1.0.1 - (2023-09-04) Updated with Test-AccessToken function. Updated to remove dependency configuration and not include supersedence configuration
1.0.2 - (2024-01-05) Fixed issue reported in #123, where the relationships table was not created correctly due a typo when creating an empty array
#>
[CmdletBinding(SupportsShouldProcess = $true)]
param(
Expand Down Expand Up @@ -51,7 +52,7 @@ function Remove-IntuneWin32AppDependency {

# Create relationships table using ternary conditional expression to handle empty supersedence relations
$Win32AppRelationshipsTable = [ordered]@{
"relationships" = if ($Supersedence) { @($Supersedence) } else { $() }
"relationships" = if ($Supersedence) { @($Supersedence) } else { @() }
}

try {
Expand Down
5 changes: 3 additions & 2 deletions Public/Remove-IntuneWin32AppSupersedence.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ function Remove-IntuneWin32AppSupersedence {
Author: Nickolaj Andersen
Contact: @NickolajA
Created: 2021-04-02
Updated: 2023-09-04
Updated: 2024-01-05
Version history:
1.0.0 - (2021-04-02) Function created
1.0.1 - (2021-08-31) Updated to use new authentication header
1.0.2 - (2023-09-04) Updated with Test-AccessToken function. Updated to remove supersedence configuration and not include dependency configuration
1.0.3 - (2024-01-05) Fixed issue reported in #123, where the relationships table was not created correctly due a typo when creating an empty array
#>
[CmdletBinding(SupportsShouldProcess = $true)]
param(
Expand Down Expand Up @@ -52,7 +53,7 @@ function Remove-IntuneWin32AppSupersedence {

# Create relationships table using ternary conditional expression to handle potential empty dependencies relations
$Win32AppRelationshipsTable = [ordered]@{
"relationships" = if ($Dependencies) { @($Dependencies) } else { $() }
"relationships" = if ($Dependencies) { @($Dependencies) } else { @() }
}

try {
Expand Down

0 comments on commit 4f2f993

Please sign in to comment.