Home » Microsoft Endpoint Manager » ConfigMgr » Application Management » Show Applications with Logon Requirement for a User to be logged on

Show Applications with Logon Requirement for a User to be logged on

A friend of mine asked me on Twitter today if I had a script that would list all applications in ConfigMgr 2012 where the Logon Requirement under the User Experience tab was set to Only when a user is logged on. A while back I made a PowerShell script that would enumerate all Applications and get the Command line for each Deployment Type. I figured that since I already had most of the code already, this shouldn’t be that hard.
Below is a picture of what he was asking about:
I found that there are two ways to go about this. The easiest way would be to enumerate all instances in the SMS_ApplicationLatest WMI class. For every instance in this class, there’s a property called LogonRequirement. Here’s the behavior of this property.
LogonRequirement is set to 1 when the following setting is configured:

  • Only when a user is logged on

LogonRequirement is set to 0 when one of the following settings is configured:

  • Whether or not a user is logged on
  • Only when no user is logged on

Instead of enumerating all of the instances, I reused parts of my old script where I deserialize the SDMPackageXML and goes through each Deployment Type. On the Deployment Type, there’s a Installer property, and below that there’s a property called RequiresLogon. In my lab environment it seemed that this property had the same behavior as for the LogonRequirement from the WMI class. The only difference was that when the Only when a user is logged on setting was configured, the RequiresLogon property would be set to True. If one of the other settings was configured, the RequiresLogon property would not be set to anything.

The script

I ended up using the following script that creates a custom object for each application where the Logon Requirement is set to Only when a user is logged on.





$SiteCode ) try { [System.Reflection.Assembly]::LoadFrom((Join-Path (Get-Item $env:SMS_ADMIN_UI_PATH).Parent.FullName “Microsoft.ConfigurationManagement.ApplicationManagement.dll”)) | Out-Null [System.Reflection.Assembly]::LoadFrom((Join-Path (Get-Item $env:SMS_ADMIN_UI_PATH).Parent.FullName “Microsoft.ConfigurationManagement.ApplicationManagement.Extender.dll”)) | Out-Null [System.Reflection.Assembly]::LoadFrom((Join-Path (Get-Item $env:SMS_ADMIN_UI_PATH).Parent.FullName “Microsoft.ConfigurationManagement.ApplicationManagement.MsiInstaller.dll”)) | Out-Null } catch { Write-Error $_.Exception.Message } $Applications = Get-WmiObject -Namespace “root\SMS\site_$($SiteCode)” -Class “SMS_Application” -ComputerName $SiteServer -Filter ‘IsLatest = “True”‘ $Applications | ForEach-Object { $LocalizedDisplayName = $_.LocalizedDisplayName $CurrentApplication = [wmi]$_.__PATH $ApplicationXML = [Microsoft.ConfigurationManagement.ApplicationManagement.Serialization.SccmSerializer]::DeserializeFromString($CurrentApplication.SDMPackageXML,$True) foreach ($DeploymentType in $ApplicationXML.DeploymentTypes) { $Object = New-Object -TypeName PSObject $RequiresLogon = { $GetRequiresLogon = $DeploymentType.Installer.RequiresLogOn $GetRequiresLogon if ($GetRequiresLogon -eq “True”) { return “True” } else { return “False” } } if ($RequiresLogon.Invoke() -eq “True”) { $Object | Add-Member -MemberType NoteProperty -Name ApplicationName -Value $LocalizedDisplayName $Object | Add-Member -MemberType NoteProperty -Name RequiresLogon -Value “True” Write-Output $Object } else { Write-Output “`nNo applications was found that requires a user to be logged on for the installation to start`n” } } }

To run the script, save it as e.g. Get-CMApplicationLogonRequirement.ps1 to C:\Scripts.
1. Open an elevated PowerShell console on your Primary Site server (or CAS).
2. Browse to C:\Scripts and run the following command:

.\Get-CMApplicationLogonRequirement.ps1 -SiteServer CAS01 -SiteCode CAS

Note! Don’t forget to amend the command above with your own site server and site code.
The picture below shows the output from the script when a match is found.
I hope this helps someone else as well, have a great weekend!


Nickolaj Andersen

Chief Technical Architect and Enterprise Mobility MVP since 2016. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows devices and deployments including automation. Awarded as PowerShell Hero in 2015 by the community for his script and tools contributions. Creator of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService to name a few. Frequent speaker at conferences such as Microsoft Ignite, NIC Conference and IT/Dev Connections including nordic user groups.


  • Hello
    First – thank you for your help to SCCM community users like us !
    This script (show user experience settings) works well and i would like to transform it for getting the product code for each application in the Detection Method tab (instead of showing user experience settings), maybe in a csv file.
    Is it possible ?
    Why : because i need to compare all theses product code in this detection method tab with product codes really installed by our packages (some times some product code are differents because of a MST file applied), i can get easily installed product code with using MSSQL requests in our old SCCM2007 infrastructure, but i don’t know how to extract product code for each application in lazy properties with SCM2012. The goal is to avoid failed deployments when CM client check if applications are installed (compliant). I don’t want to check each Application one by one 🙂

  • This is great! thanks
    I have a request on a similar tack. How do I find Packages that are advertised to users as Required? I found out a few days ago, someone had “required” acrobat to several users. As the users went around logging onto machines, acrobat licenses started to disappear!



Do you want to be notified of new posts on our site?

Please enter your email address below:

Categories use cookies to ensure that we give you the best experience on our website.