From 59b43fbe67ac3beab43962411f4f7768aa227a44 Mon Sep 17 00:00:00 2001 From: Chase Wilson Date: Sun, 3 Nov 2019 09:02:35 -0700 Subject: [PATCH 1/5] Adds multiple name process to example --- .../resources/authoringResourceComposite.md | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md b/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md index 0a8f13422888..7ef1eb973d95 100644 --- a/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md +++ b/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md @@ -153,32 +153,37 @@ The resource is now discoverable by using the Get-DscResource cmdlet, and its pr Next we create a configuration that calls the composite resource. This configuration calls the xVirtualMachine composite resource to create a virtual machine, and then calls the **xComputer** resource to rename it. ```powershell - configuration RenameVM { - + $VmNames = 'DC01', 'SQL01', 'SLQ02' + $count = 1 Import-DscResource -Module xVirtualMachine - Node localhost + foreach ($Name in $VmNames) { - xVirtualMachine VM + Node "localhost$count" { - VMName = "Test" - SwitchName = "Internal" - SwitchType = "Internal" - VhdParentPath = "C:\Demo\VHD\RTM.vhd" - VHDPath = "C:\Demo\VHD" - VMStartupMemory = 1024MB - VMState = "Running" + xVirtualMachine "VM$count" + { + VMName = "Test$count" + SwitchName = "Internal" + SwitchType = "Internal" + VhdParentPath = "C:\Demo\VHD\RTM.vhd" + VHDPath = "C:\Demo\VHD" + VMStartupMemory = 1024MB + VMState = "Running" + } } - } - Node "192.168.10.1" - { - xComputer Name + Node "192.168.10.$count" { - Name = "SQL01" - DomainName = "fourthcoffee.com" + xComputer $Name + { + Name = $Name + DomainName = "fourthcoffee.com" + } } + + $count = $count + 1 } } ``` From dfb91d3b00f60e1ef309f8741484028b27e3957b Mon Sep 17 00:00:00 2001 From: Chase Wilson Date: Sun, 3 Nov 2019 10:17:33 -0700 Subject: [PATCH 2/5] Change strategy to show multiple examples --- .../resources/authoringResourceComposite.md | 51 ++++++++++++------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md b/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md index 7ef1eb973d95..c07128a7ec14 100644 --- a/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md +++ b/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md @@ -155,16 +155,43 @@ Next we create a configuration that calls the composite resource. This configura ```powershell configuration RenameVM { - $VmNames = 'DC01', 'SQL01', 'SLQ02' - $count = 1 Import-DscResource -Module xVirtualMachine - foreach ($Name in $VmNames) + Node localhost { - Node "localhost$count" + xVirtualMachine VM { - xVirtualMachine "VM$count" + VMName = "Test" + SwitchName = "Internal" + SwitchType = "Internal" + VhdParentPath = "C:\Demo\VHD\RTM.vhd" + VHDPath = "C:\Demo\VHD" + VMStartupMemory = 1024MB + VMState = "Running" + } + } + + Node "192.168.10.1" + { + xComputer Name + { + Name = "SQL01" + DomainName = "fourthcoffee.com" + } + } +} +``` + +You can also use this resource to create multiple VMs by passing in an array of VM names to the xVirtualMachine resource. + +```PowerShell + Configuration MultipleVms + { + Import-DscResource -Module xVirtualMachine + Node localhost + { + xVirtualMachine VMs { - VMName = "Test$count" + VMName = "IIS01", "SQL01", "SQL02" SwitchName = "Internal" SwitchType = "Internal" VhdParentPath = "C:\Demo\VHD\RTM.vhd" @@ -173,19 +200,7 @@ configuration RenameVM VMState = "Running" } } - - Node "192.168.10.$count" - { - xComputer $Name - { - Name = $Name - DomainName = "fourthcoffee.com" - } - } - - $count = $count + 1 } -} ``` ## Supporting PsDscRunAsCredential From ceddbeb50cfeb949ebe93097ce10072ea89f8fad Mon Sep 17 00:00:00 2001 From: Chase Wilson Date: Mon, 4 Nov 2019 08:11:29 -0700 Subject: [PATCH 3/5] Updates for PR comments --- .../resources/authoringResourceComposite.md | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md b/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md index c07128a7ec14..186fde8533ce 100644 --- a/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md +++ b/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md @@ -184,28 +184,29 @@ configuration RenameVM You can also use this resource to create multiple VMs by passing in an array of VM names to the xVirtualMachine resource. ```PowerShell - Configuration MultipleVms +Configuration MultipleVms +{ + Import-DscResource -Module xVirtualMachine + Node localhost { - Import-DscResource -Module xVirtualMachine - Node localhost + xVirtualMachine VMs { - xVirtualMachine VMs - { - VMName = "IIS01", "SQL01", "SQL02" - SwitchName = "Internal" - SwitchType = "Internal" - VhdParentPath = "C:\Demo\VHD\RTM.vhd" - VHDPath = "C:\Demo\VHD" - VMStartupMemory = 1024MB - VMState = "Running" - } + VMName = "IIS01", "SQL01", "SQL02" + SwitchName = "Internal" + SwitchType = "Internal" + VhdParentPath = "C:\Demo\VHD\RTM.vhd" + VHDPath = "C:\Demo\VHD" + VMStartupMemory = 1024MB + VMState = "Running" } } +} ``` ## Supporting PsDscRunAsCredential ->**Note:** **PsDscRunAsCredential** is supported in PowerShell 5.0 and later. +>[!Note:] +>**PsDscRunAsCredential** is supported in PowerShell 5.0 and later. The **PsDscRunAsCredential** property can be used in [DSC configurations](../configurations/configurations.md) resource block to specify that the resource should be run under a specified set of credentials. @@ -224,4 +225,4 @@ if ($PsDscContext.RunAsUser) { ## See Also ### Concepts * [Writing a custom DSC resource with MOF](authoringResourceMOF.md) -* [Get Started with Windows PowerShell Desired State Configuration](../overview/overview.md) \ No newline at end of file +* [Get Started with Windows PowerShell Desired State Configuration](../overview/overview.md) From 53bc36f200a05da94d014085f223d437df7ee84e Mon Sep 17 00:00:00 2001 From: Chase Wilson <31453523+chasewilson@users.noreply.github.com> Date: Mon, 4 Nov 2019 09:24:09 -0700 Subject: [PATCH 4/5] Update reference/docs-conceptual/dsc/resources/authoringResourceComposite.md Co-Authored-By: Sean Wheeler --- .../docs-conceptual/dsc/resources/authoringResourceComposite.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md b/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md index 186fde8533ce..22f07bd27c15 100644 --- a/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md +++ b/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md @@ -206,7 +206,7 @@ Configuration MultipleVms ## Supporting PsDscRunAsCredential >[!Note:] ->**PsDscRunAsCredential** is supported in PowerShell 5.0 and later. +> **PsDscRunAsCredential** is supported in PowerShell 5.0 and later. The **PsDscRunAsCredential** property can be used in [DSC configurations](../configurations/configurations.md) resource block to specify that the resource should be run under a specified set of credentials. From 0759dfdb8f004758d24ef7f8a71624a07d652c5b Mon Sep 17 00:00:00 2001 From: Chase Wilson <31453523+chasewilson@users.noreply.github.com> Date: Mon, 4 Nov 2019 09:24:36 -0700 Subject: [PATCH 5/5] Update for PR suggestion Co-Authored-By: Sean Wheeler --- .../docs-conceptual/dsc/resources/authoringResourceComposite.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md b/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md index 22f07bd27c15..8b2e9f1f8bbb 100644 --- a/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md +++ b/reference/docs-conceptual/dsc/resources/authoringResourceComposite.md @@ -205,7 +205,7 @@ Configuration MultipleVms ## Supporting PsDscRunAsCredential ->[!Note:] +> [!NOTE] > **PsDscRunAsCredential** is supported in PowerShell 5.0 and later. The **PsDscRunAsCredential** property can be used in [DSC configurations](../configurations/configurations.md) resource block to specify that the