mayho33
Goto Top

SCCM Powershell New-CMDetectionClauseRegistryKeyValue

Hallo @ All

Ich hänge wieder mal bei einem der (Sarkasmus) bestens dokumentierten SCCM-CmdLets und MS schweigt sich aus was brauchbare Beispiele angeht. Ich hoffe deshalb wieder mal auf eure Hilfe.

Worum gehts:

Ich möchte meiner Script-Installer-Application eine DetectionMethod mit selbst definiertem Hive, Key, Value hinzufügen. Jedoch bekomme ich mit diesem Beispiel immer eine Fehlermeldung ausgegeben:

$clause1 = New-CMDetectionClauseRegistryKeyValue -Hive LocalMachine -KeyName "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Office16.PROPLUS" -ValueName "DisplayVersion" -PropertyType Version -ExpressionOperator GreaterEquals -ExpectedValue "16.0.4266.1001"

Nach der Angabe von -Value bekomme ich diesen Fehler:

New-CMDetectionClauseRegistryKeyValue : A positional parameter cannot be found that accepts argument '1.2.3.4'.
At line:1 char:12

back-to-top$clause1 = New-CMDetectionClauseRegistryKeyValue -Hive LocalMachine - ...

back-to-top~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidArgument: (face-smile [New-CMDetectionClauseRegistryKeyValue], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.ConfigurationManagement.Cmdlets.Dcm.Commands.NewDetectionClauseRegistryKeyValueCommand

Habe keine Ahnung was das CmdLet hier von mir will, schlussendlich soll die Klausel aber so aussehen:


unbenannt3

Kann mir jemand einen Tipp dazu geben?

Vielen Dank!

Mayho

Content-ID: 384554

Url: https://administrator.de/forum/sccm-powershell-new-cmdetectionclauseregistrykeyvalue-384554.html

Ausgedruckt am: 02.04.2025 um 04:04 Uhr

mayho33
mayho33 27.08.2018 um 01:56:27 Uhr
Goto Top
Boahhh!

Fehler gefunden:

Der Parameter -Value steht für sich alleine. Eingabe lautet also wie folgt:

$clause1 = New-CMDetectionClauseRegistryKeyValue -Hive LocalMachine -KeyName "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Office16.PROPLUS" -ValueName "DisplayVersion" -PropertyType Version -ExpressionOperator GreaterEquals -ExpectedValue "16.0.4266.1001" -Value


Add-CMScriptDeploymentType -ApplicationName "7-Zip 18.05 (x64 edition)" -DeploymentTypeName "7-Zip 18.05 (x64 edition) 3" -ContentLocation "\\SCCM01\Source$\APPLICATIONS\7-Zip\" -InstallCommand "i" -AddDetectionClause $clause1

Voilà !! Deployment und DetectionMethos werden sang - und klanklos angelegt.

Grüße!

Mayho