Skip to content

Commit a35450f

Browse files
authored
Merge pull request #4858 from MicrosoftDocs/staging
Merge latest changes to live
2 parents 4a2cf30 + 2cb0552 commit a35450f

File tree

57 files changed

+3417
-3608
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3417
-3608
lines changed

dsc/configurations/import-dscresource.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ title: Using Import-DSCResource
1111
The syntax for `Import-DSCResource` is shown below. When specifying modules by name, it is a requirement to list each on a new line.
1212

1313
```syntax
14-
Import-DscResource [-Name <ResourceName(s)>] [-ModuleName <ModuleName>]
14+
Import-DscResource [-Name <ResourceName(s)>] [-ModuleName <ModuleName>] [-ModuleVersion <ModuleVersion>]
1515
```
1616

1717
|Parameter |Description |
1818
|---------|---------|
1919
|`-Name`|The DSC resource name(s) that you must import. If the module name is specified, the command searches for these DSC resources within this module; otherwise the command searches the DSC resources in all DSC resource paths. Wildcards are supported.|
2020
|`-ModuleName`|The module name, or module specification. If you specify resources to import from a module, the command will try to import only those resources. If you specify the module only, the command imports all the DSC resources in the module.|
21+
|`-ModuleVersion`|Beginning in PowerShell 5.0, you can specify which version of a module a configuration should use. For more information, see [Import a specific version of an installed resource](sxsresource.md).|
2122

2223
```powershell
23-
Import-DscResource -ModuleName xActiveDirectory;
24+
Import-DscResource -ModuleName xActiveDirectory
2425
```
2526

2627
## Example: Use Import-DSCResource within a configuration
@@ -30,7 +31,7 @@ Configuration MSDSCConfiguration
3031
{
3132
# Search for and imports Service, File, and Registry from the module PSDesiredStateConfiguration.
3233
Import-DSCResource -ModuleName PSDesiredStateConfiguration -Name Service, File, Registry
33-
34+
3435
# Search for and import Resource1 from the module that defines it.
3536
# If only –Name parameter is used then resources can belong to different PowerShell modules as well.
3637
# TimeZone resource is from the ComputerManagementDSC module which is not installed by default.
@@ -42,7 +43,8 @@ Configuration MSDSCConfiguration
4243
# Search for and import all DSC resources inside the module PSDesiredStateConfiguration.
4344
# When specifying the modulename parameter, it is a requirement to list each on a new line.
4445
Import-DSCResource -ModuleName PSDesiredStateConfiguration
45-
Import-DSCResource -ModuleName ComputerManagementDsc
46+
# In PowerShell 5.0 and later, you can specify a ModuleVersion parameter
47+
Import-DSCResource -ModuleName ComputerManagementDsc -ModuleVersion 6.0.0.0
4648
...
4749
```
4850

@@ -142,6 +144,10 @@ Copy the contents of your desired module version to the top level of the module
142144
143145
When authoring and compiling Configurations, your resources can be stored in any directory specified by your [PSModulePath](/powershell/developer/module/modifying-the-psmodulepath-installation-path). In PowerShell 4.0, the LCM requires all DSC resource modules to be stored under "Program Files\WindowsPowerShell\Modules" or `$pshome\Modules`. Beginning in PowerShell 5.0, this requirement was removed, and resource modules can be stored in any directory specified by `PSModulePath`.
144146
147+
### ModuleVersion added
148+
149+
Beginning in PowerShell 5.0, the `-ModuleVersion` parameter allows you to specify which version of a module to use within your configuration.
150+
145151
## See also
146152
147153
- [Resources](../resources/resources.md)

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.

0 commit comments

Comments
 (0)