File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,36 @@ function GetCimSpace {
131
131
return $result
132
132
}
133
133
134
+ function ValidateCimMethodAndArguments {
135
+ [CmdletBinding ()]
136
+ param (
137
+ [Parameter (Mandatory = $true , ValueFromPipeline = $true )]
138
+ [dscResourceObject ]$DesiredState
139
+ )
140
+
141
+ $methodName = $DesiredState.properties.psobject.properties | Where-Object - Property Name -EQ ' methodName' | Select-Object - ExpandProperty Value
142
+ if (-not $methodName ) {
143
+ " 'methodName' property is required for invoking a WMI method." | Write-DscTrace - Operation Error
144
+ exit 1
145
+ }
146
+
147
+ $className = $DesiredState.type.Split (" /" )[-1 ]
148
+ $namespace = $DesiredState.type.Split (" /" )[0 ].Replace(" ." , " /" )
149
+
150
+ $cimClass = Get-CimClass - Namespace $namespace - ClassName $className - MethodName $methodName
151
+
152
+ if ($cimClass ) {
153
+ $properties = $DesiredState.properties.psobject.properties | Where-Object - Property Name -NE ' methodName'
154
+ $parameters = $cimClass.CimClassMethods | Where-Object - Property Name -EQ $methodName | Select-Object - ExpandProperty CimMethodParameters
155
+
156
+ foreach ($prop in $properties ) {
157
+
158
+ }
159
+ }
160
+
161
+ return $cimClass
162
+ }
163
+
134
164
135
165
function Invoke-DscWmi {
136
166
[CmdletBinding ()]
@@ -165,4 +195,12 @@ class dscResourceObject {
165
195
[string ] $name
166
196
[string ] $type
167
197
[PSCustomObject ] $properties
198
+ }
199
+
200
+ $inputObject = [DscResourceObject ]@ {
201
+ name = ' root.cimv2/Win32_Process'
202
+ type = ' root.cimv2/Win32_Process'
203
+ properties = [PSCustomObject ]@ {
204
+ methodName = ' Create'
205
+ }
168
206
}
You can’t perform that action at this time.
0 commit comments