Skip to content

SCCM OSD: Tweak OSDResults without UDI (Part 2)

As I mention early in SCCM OSD: Tweak OSDResults without UDI (Part 1), I will try write a part 2 of how to show up OSDResults without UDI step.

Before you start to doing this, I will highly recommend you disable F8 debug mode in winpe boot image for your production environment, for security matter. Because the script is password involved.

When you don’t use UDI to select what applications you want to install, you can use “dynamic applications”.
There are already many very nice post about how to do that, here are few examples:

My collage Tommi came up a really good idea, use Administrative categories. So we start to make our own script to install dynamic applications based on Administrative category.
And I started to work on the OSDResults without UDI.

(About the function Write-CMLogEntry, I borrowed it from Nickolaj Andersen, you will find this in many of his scripts, I found it very useful to write logs during OSD)

In the script, I have added line 90 to 123, in case if you want to priority some applications installation.

(First, disable UDI wizard or set SkipWizard to YES. 🙂 )

Step 1.
Add the service account name and password  in Collection Variables, you will find the variable name “svcaccname” and “svcaccpassword” in the script.

Step 2.
Copy my two scripts to a folder, create a package of that (without create program), let’s name it example “OSD Custom Scripts”

Step 3.
Create and assign your application to Administrative category “OSD Apps”, sama category name in script “Get-CategoryOSDApplications.ps1” line 79

Step 4.
Disable the original “Install Applications” group, and add a new one.
Create a new step “Run PowerShell Script”, Choose Package “MDT Custom Scritps”, Script name “Get-CategoryOSDApplications.ps1”, PowerShell execution policy “Bypass”

Step 5.
Create another step “Install Application”. Set Base variable name “AppID”, this is the same variable in the “Get-GategoryOSDApplications.ps1” script, line 127 “AppID$Id”.

Step 6.
Remove “SkipWizard equals “NO” ” from “OSD Results and Branding” Group Options settings

Step 7.
Disable the original “Scan Installed Apps” Step.
Add anoter “Run PowerShell Script” step, name it “Scan Installed Apps”. Choose package “OSD Custom Scripts”, Script name “Get-InstalledApps.ps1, Powershell execution policy: Bypass

If everything goes smoothly, you show get the Installed Application results at the end of your TS. example like this:


Feel free to comment if you have any questions related to this.
Here is the download link:
OneDrive: Click Here
GitHub: Click Here

14 thoughts on “SCCM OSD: Tweak OSDResults without UDI (Part 2)”

  1. Pingback: SCCM OSD: Tweak OSDResults without UDI (Part 1) | The SCCM

  2. Is it required to have svcaccname and svcaccpassword? Also in your instruction you indicated using Base Variables AppID but in step 1 you only added svcaccname and svcaccpassword but didn’t add AppID01, AppID02 to Collection Variables. How powershell script would detect AppID$Id ?

    1. I don’t add AppID01, AppID02 manually, step 3, step 4 and step 5 is how the AppID will be assigned. As I mentioned I am using dynamic applications installations. As I wrote in the beginning, I use Administrative categories, use PowerShell to detect the categories and assigned applications TS variable AppID01..AppID02..and so on.

  3. I’ve added both svcaccname and svcaccpassword and also added AppID01, AppID02…. and so on but in the end the Application Installed still blank. Any idea?

    1. You need to follow all the steps, download the scripts and make a package of it. and add it to your TS follow by step 3-7.

      1. Hello Sandy,
        I’ve followed exactly all your steps (of course I put in correct sitecode and site server in both powershell scripts). However, it still fails to scan and install any application. Using Task sequence manager, it shows:
        “… ‘0002’
        Waiting for CcmExec service to be fully operational
        CcmExec service is up and fully operational
        dwEnabled > 0, HRESULT=80004005 (e:\qfe\nts\sms\framework\core\ccmcore\util.cpp,4103)
        LSGetInternetMode: In Intranet
        Current Assigned Management Point is ***** with Version 8540 and Capabilities:
        Successfully connected to MP *****
        Setting progress step for initialization
        Setting total steps to 1
        Succeeded loading resource DLL ‘C:\WINDOWS\CCM\1033\TSRES.DLL’
        CheckForBaseVarsInTSEnv(), HRESULT=80004005 (e:\nts_sccm_release\sms\client\osdeployment\installapplication\dainstaller.cpp,236)
        daInstaller.Execute(), HRESULT=80004005 (e:\nts_sccm_release\sms\client\osdeployment\installapplication\main.cpp,265)
        No Env variable with specified basename AppID and suffix ’01’ is found. No applications installed.”

        I don’t see any error with GetOSD Categories Application List though. I think somehow after scanning and look for “OSD Apps” it does not detect any app which causes Install application failed.

        1. Hi, did you assign anything in Administrative category and name it as “OSD Apps” from General Information tab? Not the Application catalog tab.
          You can run this following script to detect if it can detect your applications correctly.

          $SiteCode = “Your site code” #change this
          $SiteServer = “Your site server” #Change this

          $svcaccname = “your svcaccname” #change this
          $svcaccpassword = “your svcaccpassword” #change this
          $Cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($svcaccname, (ConvertTo-SecureString -String $svcaccpassword -AsPlainText -Force))

          #Get Applications based on Category name “OSD Apps”
          $Query = “LocalizedCategoryInstanceNames=’OSD Apps’ and IsExpired=’False’ and IsLatest=’True'”
          $CMApps = Get-WmiObject -ComputerName $SiteServer -Class SMS_Application -Namespace root/sms/site_$sitecode -Filter $Query -Credential $Cred

          #Assign Variable to Applications.
          if ($CMApps -ne $null)
          Write-Host “Searching OSD applications to install…”
          $Count = 1
          foreach ($App in $CMApps)
          $Id = “{0:D2}” -f $Count
          $OSDAppID = “AppID$Id”
          $ApplicationName = $app.LocalizedDisplayName
          Write-Host “$OSDAppID $Applicationname”
          $Count = $Count + 1
          Write-Host ” No OSD applications to install – skipping installation step”

          1. Hello Sandy,
            Hello Sandy,
            1. did you assign anything in Administrative category and name it as “OSD Apps” from General Information tab? Not the Application catalog tab. Yes. I did assign “OSD Apps” in Administrative categories.
            2. I’ll run powershell script to see if it detects any application and get back with you shortly.
            Thanks for prompt respond.

          2. There is error of invalid query:
            Get-WmiObject : Invalid query “select * from SMS_Application where LocalizedCategoryInstanceNames=’OSD Apps’ and IsExpired=’False’ and
            At line:10 char:11
            + $CMApps = Get-WmiObject -ComputerName $SiteServer -Class SMS_Applicat …
            + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo : InvalidArgument: (:) [Get-WmiObject], ManagementException
            + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand


            1. If you run Get-WmiObject -ComputerName yoursiteserver -Class SMS_Application -Namespace root/sms/site_Yoursitecode with your sccm admin account, it should give your result, if it doesn’t, you have other issues then. And don’t just copy and paste the script from my comments, you need to check if those single/double quotes are correct, copy and paste usually make them wrong.

  4. Hello Sandy,
    If run Get-WmiObject -ComputerName mysiteserver -Class SMS_Application -Namespace root/sms/site_Mysitecode with your sccm admin account then it is fine. However as long as I add -Filter $Query then it comes up with error.
    I think somehow it can’t get through with $Query.

  5. Hi Sandy,
    I figured out the issue. It were the single/double quote from copy and paste the script. Thank you very much of your support. One more thing I’d like to ask that after running the script, it shows AppIDxx but the ApplicationName does not indicate anything


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.