SOLVED

Configuration item and Confguration baseline .. in InTune

Copper Contributor

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.

7 Replies
Perhaps a different approach 😉 What is it that you want to install/remove/push/configure on a specific set of machines?
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).
Maybe a stupid thought. but why not creating a detection rule and specify that registry key? when the key already exists ... it thinks it is installed... otherwise it will try to install it.. ANd of the app doesn't create the key, create a powershell script that launches the installation and if its done it create that registry key?
best response confirmed by Stickybit (Copper Contributor)
Solution

@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

:).... i guess we have both the same idea 🙂
* Mumbles something about great minds think alike * 😄
ohhh .. I didn't know that scripts could be used as detection methods. Nice .. now I can solve the problem.

Thanks guys. 🙂
1 best response

Accepted Solutions
best response confirmed by Stickybit (Copper Contributor)
Solution

@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

View solution in original post