Dark mode

Dark mode

There are 0 results matching

article card image dark article card image light

Published by · Jun 25, 2024 tools · 2 mins read

Introducing: macOS JAMF Offboarding Tool

Offboarding macOS Devices from JAMF in Bulk using the JAMF API with a bash script ...

See More
article card image dark article card image light

Published by · Jun 25, 2024 tools · 2 mins read

Introducing: Microsoft Cloud License Automation Tool - Part 1

Automating Microsoft Cloud License Assignment and Reporting with PowerShell and Slack for Enterprise Mobility and Security E3 ...

See More
article card image dark article card image light

Published by · Jun 18, 2024 tools · 2 mins read

Introducing: Configuration Manager Set Implicit Uninstall Flag Tool

Setting Configuration Manager ConfigMgr Implicit Uninstall Flag with PowerShell for Required Application Deployments ...

See More
article card image dark article card image light

Published by · Jun 11, 2024 configmgr · 2 mins read

Configuration Manager Next Maintenance Window SQL Function

Get Next Configuration Manager Maintenance Window from a Schedule Token with Offset Days using an SQL Function. ...

See More
article card image dark article card image light

Published by · Jun 3, 2024 tools · 2 mins read

Introducing: Windows User Rights Assignment Tool - Part 3

Add, Remove, or Replace Windows Rights Assignment with our PowerShell Tool. ...

See More
article card image dark article card image light

Published by · May 28, 2024 tools · 2 mins read

Introducing: Windows User Rights Assignment Tool - Part 2

Get and Report Windows Rights Assignment with our PowerShell Tool. ...

See More
article card image dark article card image light

Published by · May 22, 2024 tools · 1 mins read

Introducing: Windows User Rights Assignment Tool - Part 1

Get Windows Rights Assignment with our PowerShell Tool. ...

See More
article card image dark article card image light

Published by · Apr 11, 2024 tools · 2 mins read

Introducing: Intune Linux Onboarding Tool

Onboard Ubuntu Linux devices to Microsoft Intune using a bash script. Installs prerequisites and starts the user-driven enrollment. ...

See More
article card image dark article card image light

Published by · Apr 11, 2024 tools · 2 mins read

Introducing: Intune macOS Onboarding Tool

Onboard macOS devices to Microsoft Intune using a bash script that initiates the process. Optionally, the script converts mobile accounts, resets the FileVault key, and removes ...

See More
article card image dark article card image light

Published by · Jan 23, 2024 tools · 3 mins read

Introducing: Intune Device Renaming Tool

Rename Intune Devices by setting a Prefix or using a User Attribute as Prefix. Supports Windows, macOS, and Linux ...

See More
article card image dark article card image light

Published by · Dec 8, 2023 intune · 5 mins read

Intune Logs: A Deep Dive into Locations, Interpretation, and Configuration

A Comprehensive Guide to Locations, Interpretation, and Configuration of Intune Logs ...

See More
article card image dark article card image light

Published by · Aug 14, 2023 configmgr · 2 mins read

Configuration Manager Console Extension to show Device Collection Membership with Console Builder

Use the Configuration Manager Console Builder, to add Collection Membership View to the Device Node ...

See More
article card image dark article card image light

Published by · Aug 3, 2023 tools · 3 mins read

Introducing: Configuration Manager SSRS Dashboards

A Configuration Manager Dashboards solution with Reports for Software Updates, Bitlocker and more ...

See More
article card image dark article card image light

Published by · Aug 3, 2023 tools · 2 mins read

Introducing: PowerShell WMI Management Toolkit Module

Streamline your WMI Namespace, Class, and Instance Management with our PowerShell Module ...

See More
article card image dark article card image light

Published by · Jul 14, 2023 configmgr · 1 mins read

Configuration Manager detailed, filterable Port Documentation

Configuration Manager detailed, filterable port documentation as an excel document ...

See More
article card image dark article card image light

Published by · Jul 14, 2023 configmgr · 3 mins read

Configuration Manager PXE TFTP Window Size Bug

Configuration Manager TFTP Block Size and TFTP Window Size Correct Configuration ...

See More
article card image dark article card image light

Published by · Jun 18, 2023 tools · 4 mins read

Introducing: Configuration Manager Client Cache Cleanup Tool

Cleaning the Configuration Manager Client Cache the Right Way with PowerShell and Configuration Baselines ...

See More
article card image dark article card image light

Published by · Jun 18, 2023 tools · 2 mins read

Introducing: Windows Cache Cleanup Tool

Cleaning Windows and Configuration Manager Caches for Configuration Manager Build and Capture Task Sequence or Standalone Use ...

See More
article card image dark article card image light

Published by · Jun 17, 2023 tools · 1 mins read

Introducing: Windows Update Database Reinitialization Tool

Proactively repair corrupted Windows Update Database with Powershell and Configuration Manager ...

See More
article card image dark article card image light

Published by · Mar 31, 2023 tools · 3 mins read

Introducing: Configuration Manager SQL Products Reporting

A Complete SQL Products reporting solution using Configuration Manager ...

See More
article card image dark article card image light

Published by · Jan 28, 2023 configmgr · 1 mins read

Application Detection Method using the Configuration Manager Application Version

Replace hardcoded application version in scripts, with the Configuration Manager Application Version ...

See More
article card image dark article card image light

Published by · Jan 28, 2023 tools · 3 mins read

Introducing: Certificate Management Toolkit

Managing Certificates with Configuration Manager and PowerShell by using just the Public Key ...

See More
article card image dark article card image light

Published by · Jan 7, 2019 reports · 2 mins read

Configuration Manager Device Boundary and Network Information Report

List Device Boundaries and Network Information with Configuration Manager ...

See More
article card image dark article card image light

Published by · Sep 9, 1980 help · 5 mins read

MEM.Zone Blog Publishing Documentation

Publishing Documentation for MEM.Zone ...

See More

We couldn’t find anything related to

“SCCM”

BLOG / tools zone

Introducing: Configuration Manager Set Implicit Uninstall Flag Tool

Published by Popovici Ioan · Jun 18, 2024 · 2 mins read
article card image dark article card image light

Quick Summary

Configuration Manager introduced Implicit Uninstall for application deployments back in version 2107, which was released in 2021.

Since then Microsoft has not updated the powershell cmdlets to support this new feature, so in order to update multiple deployments at once we have to use an undocumented method to set this flag.

This tool was specifically created to address changing the Implicit Uninstall flag for multiple deployments.

Prerequisites


Recommendations

  • Always use a test environment to validate your implementation. ‘Hey I found this on the Internet’ is not a valid excuse for breaking production.
  • Use the WhatIf parameter to validate the changes before applying them.

Implicit Uninstall Flag

Implicit Uninstall is a nifty feature that allows automatic uninstall of an application when a device falls out of the scope of the deployment.

article card image configmgr-deployment-set-implicit-uninstall.jpg
Configuration Manager Set Implicit Uninstall

The feature is controlled by the OfferFlags property, located in the SMS_ApplicationAssignment Server WMI Class which is a bitmask containing flags that control various features of the deployment.

article card image documentation-microsoft-configmgr-offerflags.jpg
Microsoft Current OfferFlags Documentation

The undocumented property has value of 64 and is named IMPLICITUNINSTALLENABLED.

This is where things got tricky, as you need to use a XML string to set the flag which by default doesn’t exist.
You also need to account for any existing flags that are already set.

I think, I’ve managed to find an elegant 😬 solution as seen in the script below.

Notes

The flag can only be set using XML format in the SMS_ApplicationAssignment WMI class.


Parameters

ApplicationName

Specifies the application name and supports wildcards.

Notes

* will process all applications!

FlagValue

Specifies the Implicit Uninstall flag value. Default is true.

Available values:

  • True
    The application will be uninstalled when the deployment is removed.
  • False
    The application will not be uninstalled when the deployment is removed.
Notes

Use the WhatIf parameter to preview the changes.


Examples

Specific Application

Set-CMImplicitUninstall.ps1 -ApplicationName 'WinZip' -FlagValue 'True' -WhatIf

Matching Applications

Set-CMImplicitUninstall.ps1 -ApplicationName '*Zip' -FlagValue 'True' -WhatIf

All Applications

Set-CMImplicitUninstall.ps1 -ApplicationName '*' -FlagValue 'False' -WhatIf
Notes

WhatIf is used to force a dry run in these examples.


Preview

article card image powershell-set-implicit-uninstall-flag.gif
Setting Implicit Uninstall Flag

Code

  1<#
  2.SYNOPSIS
  3    Sets the Configuration Manager Implicit Uninstall flag on a application deployment.
  4.DESCRIPTION
  5    Sets the Configuration Manager Implicit Uninstall flag on a required application deployment.
  6.PARAMETER ApplicationName
  7    Specifies the application name. Supports wildcards.
  8.PARAMETER FlagValue
  9    Specifies the Implicit Uninstall flag value. Default is true.
 10    Available values are:
 11        True
 12        False
 13.EXAMPLE
 14    Set-CMImplicitUninstall.ps1 -ApplicationName '*Zip -FlagValue 'True'
 15.EXAMPLE
 16    Set-CMImplicitUninstall.ps1 -ApplicationName '*' -FlagValue 'False'
 17.EXAMPLE
 18    Set-CMImplicitUninstall.ps1 -ApplicationName '*' -FlagValue 'True' -WhatIf
 19.INPUTS
 20    None.
 21.OUTPUTS
 22    None.
 23.NOTES
 24    Created by Ioan Popovici
 25.LINK
 26    https://MEM.Zone
 27.LINK
 28    https://MEMZ.one/Set-CMImplicitUninstall-CHANGELOG
 29.LINK
 30    https://MEMZ.one/Set-CMImplicitUninstall-GIT
 31.LINK
 32    https://MEM.Zone/ISSUES
 33.LINK
 34    https://docs.microsoft.com/en-us/mem/configmgr/develop/reference/apps/sms_applicationassignment-server-wmi-class
 35.COMPONENT
 36    Configuration Manager
 37.FUNCTIONALITY
 38    Application deployment Implicit Uninstall flag.
 39#>
 40
 41## Set script requirements
 42#Requires -Version 5.0
 43
 44##*=============================================
 45##* VARIABLE DECLARATION
 46##*=============================================
 47#region VariableDeclaration
 48
 49## Get script parameters
 50[CmdletBinding(SupportsShouldProcess=$true)]
 51Param (
 52    [Parameter(Mandatory=$true,HelpMessage='Enter application name',Position=0)]
 53    [ValidateNotNullorEmpty()]
 54    [Alias('Name')]
 55    [string]$ApplicationName,
 56    [Parameter(Mandatory=$false,HelpMessage="Valid options are: 'true' or 'false'",Position=1)]
 57    [ValidateNotNullorEmpty()]
 58    [ValidateSet('true','false')]
 59    [Alias('Flag')]
 60    [string]$FlagValue = 'true'
 61)
 62
 63## Set variables
 64[int16]$ProgressStep = 0
 65
 66## Set the bitmask table for the OfferFlags bitmask
 67[Flags()]Enum OfferFlagsBitmask {
 68    PreDeploy                = 1
 69    OnDemand                 = 2
 70    EnableProcessTermination = 4
 71    AllowUsersToRepairApp    = 8
 72    RelativeSchedule         = 16
 73    HighImpactDeployment     = 32
 74    ImplicitUninstallEnabled = 64
 75}
 76
 77## Set the default xml for the ImplicitUninstallEnabled flag
 78[xml]$AdditionalPropertiesDefaultXML =
 79@'
 80<?xml version="1.0" encoding="utf-16"?>
 81<Properties>
 82    <ImplicitUninstallEnabled>true</ImplicitUninstallEnabled>
 83</Properties>
 84'@
 85
 86
 87#endregion
 88##*=============================================
 89##* END VARIABLE DECLARATION
 90##*=============================================
 91
 92
 93##*=============================================
 94##* SCRIPT BODY
 95##*=============================================
 96#region ScriptBody
 97
 98## Import ConfigMgr Powershell module and changing context
 99Try {
100    Import-Module $env:SMS_ADMIN_UI_PATH.Replace('\bin\i386','\bin\configurationmanager.psd1') -ErrorAction 'Stop'
101}
102Catch {
103    Throw "Importing ConfigMgr Powershell module - Failed!`n$PsItem"
104}
105
106## Get the CMSITE SiteCode and change the connection context
107Try {
108    $SiteCode = Get-PSDrive -PSProvider 'CMSITE'
109    Push-Location "$($SiteCode.Name):\"
110}
111Catch {
112    Throw "Changing connection context - Failed!`n$PsItem"
113}
114
115## Process applications
116Try {
117
118    ## Get all required application Assignments
119    $ApplicationAssignments = Get-CMApplicationDeployment -Name $ApplicationName | Where-Object -Property 'OfferTypeID' -eq 0
120
121    ## Set progress variables
122    [int]$ProgressTotal = $ApplicationAssignments.Count
123
124    ## Process each application deployment
125    ForEach ($ApplicationAssignment in $ApplicationAssignments) {
126
127        ## Show progress status
128        $ProgressStep ++
129        [int]$AssignmentID = $ApplicationAssignment.AssignmentID
130        [int16]$PercentComplete = ($ProgressStep / $ProgressTotal) * 100
131        [string]$ApplicationName = $ApplicationAssignment.ApplicationName
132        Write-Progress -Activity 'Processing Applications... ' -CurrentOperation "$ApplicationName --> $AssignmentID" -PercentComplete $PercentComplete
133        Write-Verbose -Message "ApplicationName: $ApplicationName --> AssignmentID: $AssignmentID" -Verbose
134
135        ## Get the application Assignment info
136        $AssignmentInfo = Get-CimInstance -Namespace "ROOT\SMS\site_$SiteCode" -ClassName 'SMS_ApplicationAssignment' -Filter "AssignmentID = $AssignmentID"
137        #  Get Assignment OfferFlag bitmask
138        [OfferFlagsBitmask]$OfferFlags = $AssignmentInfo.OfferFlags
139        Write-Verbose -Message "OfferFlags: $OfferFlags" -Verbose
140        #  Get the additional properties xml
141        [xml]$AdditionalProperties = $AssignmentInfo.AdditionalProperties
142        Write-Verbose -Message "AdditionalProperties: $($AdditionalProperties.Properties)" -Verbose
143
144
145        ## Set the ImplicitUninstallEnabled flag properties
146        #  If there are no additional properties, set the default properties xml
147        If (-not $AdditionalProperties) { $AdditionalProperties = $AdditionalPropertiesDefaultXML }
148        #  If the ImplicitUninstallEnabled property is not present add it to the xml
149        If (-not $AdditionalProperties.Properties.ImplicitUninstallEnabled) { $AdditionalProperties.Properties.SetAttribute('ImplicitUninstallEnabled', 'true') }
150        #  If the ImplicitUninstallEnabled property value is not 'true' set it to 'true'
151        If (-not $AdditionalProperties.Properties.ImplicitUninstallEnabled -ne 'true') { $AdditionalProperties.Properties.ImplicitUninstallEnabled = 'true' }
152        #  If the OfferFlags bitmask does not contain the ImplicitUninstallEnabled flag, add it. (64 is the bitmask value for the ImplicitUninstallEnabled flag, you won't find this value in the documentation)
153        If (-not $OfferFlags.HasFlag([OfferFlagsBitmask]::ImplicitUninstallEnabled)) { [int]$OfferFlagsValue = $OfferFlags.GetHashCode() + 64 }
154
155        ## Update the application Assignment if needed
156        [boolean]$ShouldProcess = $PSCmdlet.ShouldProcess("$ApplicationName --> $AssignmentID", "Set Implicit Uninstall Flag to '$FlagValue'")
157        If ($ShouldProcess) {
158            $AssignmentInfo | Set-CimInstance -Property @{ AdditionalProperties = ($AdditionalProperties.OuterXml); OfferFlags = $OfferFlagsValue } -ErrorAction 'Stop'
159            Write-Verbose -Message  "Successfully updated $ApplicationName --> $AssignmentID!" -Verbose
160        }
161        Else { Write-Verbose -Message  "Nothing to update for $ApplicationName --> $AssignmentID!" -Verbose }
162    }
163
164    ## Output success
165    [string]$Output = 'Successfully processed the ImplicitUninstallEnabled flag on all required application deployments!'
166    }
167    Catch {
168        Throw "Set ImplicitUninstall flag Failed!`n$PsItem"
169    }
170    Finally {
171        Write-Output -InputObject $Output
172    }
173
174    ## Return to Script Path
175    Pop-Location
176
177    ## Remove ConfigMgr PSH Module
178    Remove-Module 'ConfigurationManager' -Force -ErrorAction 'SilentlyContinue'
179
180#endregion
181##*=============================================
182##* END SCRIPT BODY
183##*=============================================

SHARE

article card image dark article card image light

Published by · Jun 18, 2023 tools · 2 mins read

Introducing: Windows Cache Cleanup Tool

Cleaning Windows and Configuration Manager Caches for Configuration Manager Build and Capture Task Sequence or Standalone Use ...

See More
article card image dark article card image light

Published by · Jun 11, 2024 configmgr · 2 mins read

Configuration Manager Next Maintenance Window SQL Function

Get Next Configuration Manager Maintenance Window from a Schedule Token with Offset Days using an SQL Function. ...

See More