So I have Script to Create an Application in SCCM and a Script to Create the DeploymentType. in the DeploymentType, I am Creating a Detection Method that uses the Registry.
$clause1 = New-CMDetectionClauseRegistryKeyValue -Hive LocalMachine -KeyName "SOFTWARE\Folder1\Folrder2\$DepName" -ValueName "some_Value" -PropertyType String -ExpressionOperator IsEquals -ExpectedValue $DepNummer -Value
Add-CMScriptDeploymentType -ApplicationName $DepName -DeploymentTypeName $DepTypeName -ContentLocation $DepContent -InstallCommand $DepInst -UninstallCommand $DepUninst -AddDetectionClause $Clause1 -EstimatedRuntimeMins $DepMaxRun -MaximumRuntimeMins $DepMinRun -LogonRequirementType WhetherOrNotUserLoggedOn -UserInteractionMode Hidden -InstallationBehaviorType InstallForSystem -AddRequirement $oDTRule
The Script works so far but I have one small issue. if you look at a Detection Method by Registry there is the Checkbox
“This registry key is associated with a 32-bit application on 64-bit systems” I know for what it is but I just can't figure out what I have to do to Create the DM without this box being checked.
I pulled the info about the DeploymenType with Get-CMDeploymentType. I found the parts für the DM but no hint about this Checkbox.
<EnhancedDetectionMethod>
<Settings xmlns=\"http://schemas.microsoft.com/SystemCenterConfigurationManager/2009/AppMgmtDigest\">
<SimpleSetting xmlns=\"http://schemas.microsoft.com/SystemsCenterConfigurationManager/2009/07/10/DesiredConfiguration\" LogicalName=\"RegSetting_8277224f-cd13-48b8-8a94-efbe3b67d5ea\" DataType=\"String\">
<Annotation xmlns=\"http://schemas.microsoft.com/SystemsCenterConfigurationManager/2009/06/14/Rules\">
<DisplayName Text=\"\"/>
<Description Text=\"\"/>
</Annotation>
<RegistryDiscoverySource Hive=\"HKEY_LOCAL_MACHINE\" Depth=\"Base\" Is64Bit=\"true\" CreateMissingPath=\"true\">
<Key>SOFTWARE\\Folder1\\Folder2\\Stuff</Key>
<ValueName>some_Value</ValueName>
</RegistryDiscoverySource>
</SimpleSetting>
</Settings>
<Rule xmlns=\"http://schemas.microsoft.com/SystemsCenterConfigurationManager/2009/06/14/Rules\" id=\"ScopeId_F7D7B005-5475-42F3-8D53-C6F2B0DA1B17/DeploymentType_1dae9225-e8ee-4923-b38f-2bdcf3bd656d\" Severity=\"Informational\" NonCompliantWhenSettingIsNotFound=\"false\">
<Annotation>
<DisplayName Text=\"\"/>
<Description Text=\"\"/>
</Annotation>
<Expression>
<Operator>Equals</Operator>
<Operands>
<SettingReference AuthoringScopeId=\"ScopeId_F7D7B005-5475-42F3-8D53-C6F2B0DA1B17\" LogicalName=\"Application_6f616284-4cb8-423b-94a5-20d6e5f687fd\" Version=\"8\" DataType=\"String\" SettingLogicalName=\"RegSetting_8277224f-cd13-48b8-8a94-efbe3b67d5ea\" SettingSourceType=\"Registry\" Method=\"Value\" Changeable=\"false\"/>
<ConstantValue Value=\"some_Value\" DataType=\"String\"/>
</Operands>
</Expression>
</Rule>
</EnhancedDetectionMethod>
has anyone an idea.
thx in advanced
so never asume anything.
as i said and you can see above i pulled the info via get-CMDeploymentType and looked at it once with Checkbox checked and once when i manualy set it unchecked.
But something trolled me.
<RegistryDiscoverySource Hive=\"HKEY_LOCAL_MACHINE\" Depth=\"Base\" Is64Bit=\"true\" CreateMissingPath=\"true\">
The Magic is in the Is64Bit="\true\" part
i am sure that after changing it manualy in SCCM this was still true so i did not look into the switch -is64Bit
Well someone on the TechNet Forum said i should look into it again and i did. i put it into the script and oh wonder it works.
New-CMDetectionClauseRegistryKeyValue -Hive LocalMachine -KeyName "SOFTWARE\Folder1\Folrder2\$DepName" -Is64Bit -ValueName "some_Value" -PropertyType String -ExpressionOperator IsEquals -ExpectedValue $DepNummer -Value
This is the Version so the Checkbox is not checked.
regards
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.