Skip to content

Commit 9bbf66a

Browse files
authored
Merge branch 'staging' into pipeline-chain-operators
2 parents ab5ef75 + 2cb0552 commit 9bbf66a

37 files changed

+976
-912
lines changed

reference/3.0/CimCmdlets/Invoke-CimMethod.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ If the InputObject parameter is specified, the cmdlet works in one of the follow
110110
### Example 1: Invoke a method
111111

112112
```powershell
113-
PS C:\>Invoke-CimMethod -Query 'select * from Win32_Process where name like "notepad%"' -MethodName "Terminate"
113+
Invoke-CimMethod -Query 'select * from Win32_Process where name like "notepad%"' -MethodName "Terminate"
114114
```
115115

116116
This command invokes the method named Terminate on the CIM class named Win32_Process. The CIM class
@@ -119,8 +119,8 @@ is retrieved by the query "Select * from Win32_Process where name like 'notepad%
119119
### Example 2: Invoke a method using CIM instance object
120120

121121
```powershell
122-
PS C:\>$x = Get-CimInstance -Query 'Select * from Win32_Process where name like "notepad%"'
123-
PS C:\>Invoke-CimMethod -InputObject $x -MethodName GetOwner
122+
$x = Get-CimInstance -Query 'Select * from Win32_Process where name like "notepad%"'
123+
Invoke-CimMethod -InputObject $x -MethodName GetOwner
124124
```
125125

126126
This set of commands retrieves the CIM instance object and stores it in a variable named $x using
@@ -130,24 +130,24 @@ Invoke-CimMethod cmdlet, and the GetOwner method is invoked for the CimInstance.
130130
### Example 3: Invoke a static method
131131

132132
```powershell
133-
PS C:\>Invoke-CimMethod -ClassName Win32_Process -MethodName "Create" -Arguments @{ Path = "notepad.exe" }
133+
Invoke-CimMethod -ClassName Win32_Process -MethodName "Create" -Arguments @{ Path = "notepad.exe" }
134134
```
135135

136136
This command invokes the static method Create on the class named Win32_Process, with the arguments specified by the Arguments parameter.
137137

138138
### Example 4: Invoke a method using arguments
139139

140140
```powershell
141-
PS C:\>Invoke-CimMethod -ClassName Win32_Process -MethodName "Create" -Arguments @{ CommandLine = 'notepad.exe'; CurrentDirectory = "C:\windows\system32" }
141+
Invoke-CimMethod -ClassName Win32_Process -MethodName "Create" -Arguments @{ CommandLine = 'notepad.exe'; CurrentDirectory = "C:\windows\system32" }
142142
```
143143

144144
This command invokes the method named Create by using the Arguments parameter.
145145

146146
### Example 5: Client-side validation
147147

148148
```powershell
149-
PS C:\>$c = Get-CimClass -ClassName Win32_Process
150-
PS C:\>Invoke-CimMethod -CimClass $c -MethodName "xyz" -Arguments @{ CommandLine = 'notepad.exe' }
149+
$c = Get-CimClass -ClassName Win32_Process
150+
Invoke-CimMethod -CimClass $c -MethodName "xyz" -Arguments @{ CommandLine = 'notepad.exe' }
151151
```
152152

153153
This set of commands performs client-side validation for the method named xyz by passing a CimClass
@@ -166,7 +166,7 @@ Parameter Sets: (All)
166166
Aliases:
167167

168168
Required: False
169-
Position: 2
169+
Position: 1
170170
Default value: None
171171
Accept pipeline input: True (ByPropertyName)
172172
Accept wildcard characters: False
@@ -187,7 +187,7 @@ Parameter Sets: CimClassSessionSet, CimClassComputerSet
187187
Aliases:
188188

189189
Required: True
190-
Position: 1
190+
Position: 0
191191
Default value: None
192192
Accept pipeline input: True (ByValue)
193193
Accept wildcard characters: False
@@ -223,7 +223,7 @@ Parameter Sets: ClassNameComputerSet, ClassNameSessionSet
223223
Aliases: Class
224224

225225
Required: True
226-
Position: 1
226+
Position: 0
227227
Default value: None
228228
Accept pipeline input: True (ByPropertyName)
229229
Accept wildcard characters: False
@@ -268,7 +268,7 @@ Parameter Sets: CimInstanceComputerSet, CimInstanceSessionSet
268268
Aliases: CimInstance
269269

270270
Required: True
271-
Position: 1
271+
Position: 0
272272
Default value: None
273273
Accept pipeline input: True (ByValue)
274274
Accept wildcard characters: False
@@ -287,7 +287,7 @@ Parameter Sets: (All)
287287
Aliases: Name
288288

289289
Required: True
290-
Position: 3
290+
Position: 2
291291
Default value: None
292292
Accept pipeline input: True (ByPropertyName)
293293
Accept wildcard characters: False
@@ -298,7 +298,7 @@ Accept wildcard characters: False
298298
Specifies the namespace for the CIM operation.
299299
300300
The default namespace is root/cimv2. You can use tab completion to browse the list of namespaces,
301-
because Windows PowerShell gets a list of namespaces from the local WMI server to provide the list
301+
because PowerShell gets a list of namespaces from the local WMI server to provide the list
302302
of namespaces.
303303
304304
```yaml
@@ -388,10 +388,9 @@ The URI is used to identify a specific type of resource, such as disks or proces
388388
A URI consists of a prefix and a path to a resource.
389389
For example:
390390
391-
```
392-
http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_LogicalDisk
393-
http://intel.com/wbem/wscim/1/amt-schema/1/AMT_GeneralSettings
394-
```
391+
`http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_LogicalDisk`
392+
393+
`http://intel.com/wbem/wscim/1/amt-schema/1/AMT_GeneralSettings`
395394

396395
By default, if you do not specify this parameter, the DMTF standard resource URI `http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/` is used and the class name is appended to it.
397396

reference/3.0/CimCmdlets/New-CimInstance.md

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ New-CimInstance -ResourceUri <Uri> [-Key <String[]>] [[-Property] <IDictionary>]
4141
[-OperationTimeoutSec <UInt32>] [-ComputerName <String[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
4242
```
4343

44-
### CimClassComputerSet
44+
### CimClassSessionSet
4545
```
4646
New-CimInstance [-CimClass] <CimClass> [[-Property] <IDictionary>] [-OperationTimeoutSec <UInt32>]
47-
[-ComputerName <String[]>] [-ClientOnly] [-WhatIf] [-Confirm] [<CommonParameters>]
47+
-CimSession <CimSession[]> [-ClientOnly] [-WhatIf] [-Confirm] [<CommonParameters>]
4848
```
4949

50-
### CimClassSessionSet
50+
### CimClassComputerSet
5151
```
5252
New-CimInstance [-CimClass] <CimClass> [[-Property] <IDictionary>] [-OperationTimeoutSec <UInt32>]
53-
-CimSession <CimSession[]> [-ClientOnly] [-WhatIf] [-Confirm] [<CommonParameters>]
53+
[-ComputerName <String[]>] [-ClientOnly] [-WhatIf] [-Confirm] [<CommonParameters>]
5454
```
5555

5656
## DESCRIPTION
@@ -63,8 +63,8 @@ By default, the New-CimInstance cmdlet creates an instance on the local computer
6363
## EXAMPLES
6464

6565
### Example 1: Create an instance of a CIM class
66-
```
67-
PS C:\>New-CimInstance -ClassName Win32_Environment -Property @{Name="testvar";VariableValue="testvalue";UserName="domain\user"}
66+
```powershell
67+
New-CimInstance -ClassName Win32_Environment -Property @{Name="testvar";VariableValue="testvalue";UserName="domain\user"}
6868
```
6969

7070
This command creates an instance of a CIM Class named win32_environment in the root/cimv2 namespace on the computer.
@@ -74,26 +74,26 @@ No client side validation is performed if the class does not exist, the properti
7474
If the instance is created successfully, then the New-CimInstance cmdlet outputs the newly created instance.
7575

7676
### Example 2: Create an instance of a CIM class using a class schema
77-
```
78-
PS C:\>$class = Get-CimClass -ClassName Win32_Environment
77+
```powershell
78+
$class = Get-CimClass -ClassName Win32_Environment
7979
8080
8181
82-
PS C:\>New-CimInstance -CimClass $class -Property @{Name="testvar";VariableValue="testvalue";UserName="Contoso\User1"}
82+
New-CimInstance -CimClass $class -Property @{Name="testvar";VariableValue="testvalue";UserName="Contoso\User1"}
8383
```
8484

8585
This set of commands retrieves a CIM class object and stores it in a variable named $class using the Get-CimClass cmdlet.
8686
The contents of the variable are then passed to the New-CimInstance cmdlet.
8787

8888
### Example 3: Create a dynamic instance on the client
89-
```
90-
PS C:\>$a = New-CimInstance -ClassName Win32_Process -Property @{Handle=0} -Key Handle -ClientOnly
89+
```powershell
90+
$a = New-CimInstance -ClassName Win32_Process -Property @{Handle=0} -Key Handle -ClientOnly
9191
9292
93-
PS C:\>Get-CimInstance -CimInstance $a
93+
Get-CimInstance -CimInstance $a
9494
9595
96-
PS C:\>Invoke-CimMethod -CimInstance $a -MethodName GetOwner
96+
Invoke-CimMethod -CimInstance $a -MethodName GetOwner
9797
```
9898

9999
This set of commands creates a dynamic instance of a CIM class named win32_Process on the client computer without getting the instance from the server.
@@ -103,12 +103,12 @@ The Get-CimInstance cmdlet then retrieves a particular single instance, and invo
103103
This dynamic instance can be used to perform operations if the instance with this key exists on the server.
104104

105105
### Example 4: Create an instance for a CIM class of a specific namespace
106-
```
107-
PS C:\>$class = Get-CimClass -ClassName MSFT_Something -Namespace root/somewhere
106+
```powershell
107+
$class = Get-CimClass -ClassName MSFT_Something -Namespace root/somewhere
108108
109109
110110
111-
PS C:\>New-CimInstance -CimClass $class -Property @{"Prop1"=1;"Prop2"="value"} -ClientOnly
111+
New-CimInstance -CimClass $class -Property @{"Prop1"=1;"Prop2"="value"} -ClientOnly
112112
```
113113

114114
This set of commands gets an instance of a CIM class named MSFT_Something in the namespace root/somewhere and stores it in a variable named $class using the Get-CimClass cmdlet.
@@ -129,11 +129,11 @@ Using this parameter results in better client side schema validations.
129129

130130
```yaml
131131
Type: CimClass
132-
Parameter Sets: CimClassComputerSet, CimClassSessionSet
132+
Parameter Sets: CimClassSessionSet, CimClassComputerSet
133133
Aliases:
134134

135135
Required: True
136-
Position: 1
136+
Position: 0
137137
Default value: None
138138
Accept pipeline input: True (ByValue)
139139
Accept wildcard characters: False
@@ -158,27 +158,27 @@ Accept wildcard characters: False
158158
159159
### -ClassName
160160
Specifies the name of the CIM class of which the operation creates an instance.
161-
NOTE: You can use tab completion to browse the list of classes, because Windows PowerShell gets a list of classes from the local WMI server to provide a list of class names.
161+
NOTE: You can use tab completion to browse the list of classes, because PowerShell gets a list of classes from the local WMI server to provide a list of class names.
162162
163163
```yaml
164164
Type: String
165165
Parameter Sets: ClassNameComputerSet, ClassNameSessionSet
166166
Aliases:
167167

168168
Required: True
169-
Position: 1
169+
Position: 0
170170
Default value: None
171171
Accept pipeline input: True (ByPropertyName)
172172
Accept wildcard characters: False
173173
```
174174
175175
### -ClientOnly
176176
Indicates that the instance is only created in PowerShell without going to the CIM server.
177-
You can use this parameter to create an in-memory CIM instance for use in subsequent Windows PowerShell operations.
177+
You can use this parameter to create an in-memory CIM instance for use in subsequent PowerShell operations.
178178
179179
```yaml
180180
Type: SwitchParameter
181-
Parameter Sets: ClassNameComputerSet, ClassNameSessionSet, CimClassComputerSet, CimClassSessionSet
181+
Parameter Sets: ClassNameComputerSet, ClassNameSessionSet, CimClassSessionSet, CimClassComputerSet
182182
Aliases: Local
183183

184184
Required: False
@@ -275,7 +275,7 @@ Parameter Sets: (All)
275275
Aliases: Arguments
276276

277277
Required: False
278-
Position: 2
278+
Position: 1
279279
Default value: None
280280
Accept pipeline input: True (ByPropertyName)
281281
Accept wildcard characters: False
@@ -292,8 +292,6 @@ For example:
292292

293293
`http://intel.com/wbem/wscim/1/amt-schema/1/AMT_GeneralSettings`
294294

295-
296-
297295
By default, if you do not specify this parameter, the DMTF standard resource URI `http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/` is used and the class name is appended to it.
298296

299297
ResourceURI can only be used with CIM sessions created using the WSMan protocol, or when specifying the ComputerName parameter, which creates a CIM session using WSMan.

reference/3.0/CimCmdlets/Set-CimInstance.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ If the InputObject parameter is specified, the cmdlet works in one of the follow
7070
### Example 1: Set the CIM instance
7171

7272
```powershell
73-
PS C:\>Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"}
73+
Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"}
7474
```
7575

7676
This command sets the value of the VariableValue property to abcd using the Query parameter.
@@ -79,7 +79,7 @@ You can modify instances matching a Windows Management Instrumentation Query Lan
7979
### Example 2: Set the CIM instance property using pipeline
8080

8181
```powershell
82-
PS C:\>Get-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' | Set-CimInstance -Property @{VariableValue="abcd"}
82+
Get-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' | Set-CimInstance -Property @{VariableValue="abcd"}
8383
```
8484

8585
This command retrieves the CIM instance object filtered by the Query parameter using the
@@ -89,8 +89,8 @@ the value of VariableValue property to abcd.
8989
### Example 3: Set the CIM instance property using input object
9090

9191
```powershell
92-
PS C:\>$x = Get-CimInstance -Query 'Select * from Win32_Environment where Name="testvar"'
93-
PS C:\>Set-CimInstance -InputObject $x -Property @{VariableValue="somevalue"} -PassThru
92+
$x = Get-CimInstance -Query 'Select * from Win32_Environment where Name="testvar"'
93+
Set-CimInstance -InputObject $x -Property @{VariableValue="somevalue"} -PassThru
9494
```
9595

9696
This set of commands retrieves the CIM instance objects filtered by the Query parameter in to a
@@ -102,9 +102,9 @@ object.
102102
### Example 4: Set the CIM instance property
103103

104104
```powershell
105-
PS C:\>$x = Get-CimInstance -Query 'Select * from Win32_Environment where name="testvar"'
106-
PS C:\>$x.VariableValue = "Change"
107-
PS C:\>Set-CimInstance -CimInstance $x -PassThru
105+
$x = Get-CimInstance -Query 'Select * from Win32_Environment where name="testvar"'
106+
$x.VariableValue = "Change"
107+
Set-CimInstance -CimInstance $x -PassThru
108108
```
109109

110110
This set of commands retrieves the CIM instance object that is specified in the Query parameter
@@ -116,7 +116,7 @@ object.
116116
### Example 5: Show the list of CIM instances to modify using WhatIf
117117

118118
```powershell
119-
PS C:\>Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"} -WhatIf
119+
Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"} -WhatIf
120120
```
121121

122122
This command uses the common parameter WhatIf to specify that the modification should not be done,
@@ -125,7 +125,7 @@ but only output what would happen if it were done.
125125
### Example 6: Set the CIM instance after confirmation from the user
126126

127127
```powershell
128-
PS C:\>Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"} -Confirm
128+
Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"} -Confirm
129129
```
130130

131131
This command uses the common parameter Confirm to specify that the modification should be done only
@@ -134,8 +134,8 @@ after confirmation from the user.
134134
### Example 7: Set the created CIM instance
135135

136136
```powershell
137-
PS C:\>$x = New-CimInstance -ClassName Win32_Environment -Property @{Name="testvar";UserName="domain\user"} -Keys Name,UserName -ClientOnly
138-
PS C:\>Set-CimInstance -CimInstance $x -Property @{VariableValue="somevalue"} -PassThru
137+
$x = New-CimInstance -ClassName Win32_Environment -Property @{Name="testvar";UserName="domain\user"} -Keys Name,UserName -ClientOnly
138+
Set-CimInstance -CimInstance $x -Property @{VariableValue="somevalue"} -PassThru
139139
```
140140

141141
This set of commands creates a CIM instance with the specified properties using the New-CimInstance
@@ -198,7 +198,7 @@ Parameter Sets: CimInstanceComputerSet, CimInstanceSessionSet
198198
Aliases: CimInstance
199199

200200
Required: True
201-
Position: 1
201+
Position: 0
202202
Default value: None
203203
Accept pipeline input: True (ByValue)
204204
Accept wildcard characters: False
@@ -298,7 +298,7 @@ Parameter Sets: QuerySessionSet, QueryComputerSet
298298
Aliases:
299299

300300
Required: True
301-
Position: 1
301+
Position: 0
302302
Default value: None
303303
Accept pipeline input: True (ByPropertyName)
304304
Accept wildcard characters: False

0 commit comments

Comments
 (0)