Forum Discussion

Stickybit's avatar
Stickybit
Copper Contributor
Jan 17, 2022

Configuration item and Confguration baseline .. in InTune

Hi all


New to Intune .. and in trouble. 🙂

 

I need to check if some registrykeys exists on devices, and then dynamically add/remove devices to/from a group if the key exists. How can this be done?

 

In SCCM I would create a configuration baseline and add the resulting devices to a collection .. but .. no configuration baselines or collections exists in InTune. 🙂

A hint please.

  • Stickybit 

     

    - Publish the app to all machines
    - Use a detection script in the with something like this:

     

    if ((Get-ItemProperty -Path HKLM:\SOFTWARE\Company\App).Version -eq '1.2') {
         if (test-path -Path 'C:\Program Files\Company\App\app.exe') {
            write-host Company App key found with version 1.2 and software is installed
            exit 0
        }
        else {
            write-host Company app key found with version 1.2 but software is not installed
            exit 1
        }
        
    }
    
    if (-not (Get-ItemProperty -Path HKLM:\SOFTWARE\Company\App).Version -eq '1.2') {
        write-host Company App key not found so no need to install software
        exit 0
    }

     

    So.. If the specific key exists, the one that you want to detect if installation of the software is needed, then it will check for the software by checking the path in c:\program files. If it's not there, it will report it and exit with exit code 1. That way it will know it will have to install the software.

     

    If the specific key doesn't exist on the system, it will exit with exit code 0 telling Intune that the software is installed (Not needed actually, but you know what I mean 😉 )

     

    And like Rudy Ooms said, if the specific key is not there.. You can also create it, I read it like you already had that key present to specify a certain type of machine

  • Perhaps a different approach 😉 What is it that you want to install/remove/push/configure on a specific set of machines?
    • Stickybit's avatar
      Stickybit
      Copper Contributor
      A different approach is probably needed. 🙂

      The problem: I got an application (Windows App Win32), that is assigned to a group of users - with required installation. This application needs to be skipped, if specific registry keys exists on the device.

      I guess that I need to add a dynamic group as excluded assignment - and somehow automatically populate this group with users that has the registry keys (this is where I would have used a configuration item / baseline item with SCCM).
      • Stickybit 

         

        - Publish the app to all machines
        - Use a detection script in the with something like this:

         

        if ((Get-ItemProperty -Path HKLM:\SOFTWARE\Company\App).Version -eq '1.2') {
             if (test-path -Path 'C:\Program Files\Company\App\app.exe') {
                write-host Company App key found with version 1.2 and software is installed
                exit 0
            }
            else {
                write-host Company app key found with version 1.2 but software is not installed
                exit 1
            }
            
        }
        
        if (-not (Get-ItemProperty -Path HKLM:\SOFTWARE\Company\App).Version -eq '1.2') {
            write-host Company App key not found so no need to install software
            exit 0
        }

         

        So.. If the specific key exists, the one that you want to detect if installation of the software is needed, then it will check for the software by checking the path in c:\program files. If it's not there, it will report it and exit with exit code 1. That way it will know it will have to install the software.

         

        If the specific key doesn't exist on the system, it will exit with exit code 0 telling Intune that the software is installed (Not needed actually, but you know what I mean 😉 )

         

        And like Rudy Ooms said, if the specific key is not there.. You can also create it, I read it like you already had that key present to specify a certain type of machine

Resources