From 7b6e5a044419951e0f950ca2a8e685292716ac9f Mon Sep 17 00:00:00 2001 From: Alex Kokkinos Date: Mon, 18 Jun 2018 03:37:02 -0400 Subject: [PATCH 1/9] xEnvironment Path Documentation Update (#425) - xEnvironment path documentation update demonstrating usage with multiple values (issue #415). --- ...nvironment_CreateMultiplePathVariables.ps1 | 28 +++++++++++++++++++ ...ample_xEnvironment_RemovePathVariables.ps1 | 27 ++++++++++++++++++ README.md | 6 ++-- 3 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 Examples/Sample_xEnvironment_CreateMultiplePathVariables.ps1 create mode 100644 Examples/Sample_xEnvironment_RemovePathVariables.ps1 diff --git a/Examples/Sample_xEnvironment_CreateMultiplePathVariables.ps1 b/Examples/Sample_xEnvironment_CreateMultiplePathVariables.ps1 new file mode 100644 index 000000000..c13b22493 --- /dev/null +++ b/Examples/Sample_xEnvironment_CreateMultiplePathVariables.ps1 @@ -0,0 +1,28 @@ +<# + .SYNOPSIS + Ensures that the 'TestPathEnvironmentVariable' environment variable exists and that + its value includes both "C:\test123" and "C:\test456". If one or both of these values do not exist + in the environment variable, they will be appended without modifying any preexisting values. + In this example changes are made to both the machine and the process. + +#> +Configuration Sample_xEnvironment_CreateMultiplePathVariables +{ + param () + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xEnvironment CreateMultiplePathEnvironmentVariables + { + Name = 'TestPathEnvironmentVariable' + Value = 'C:\test123;C:\test456;C:\test789' + Ensure = 'Present' + Path = $true + Target = @('Process', 'Machine') + } + } +} + +Sample_xEnvironment_CreateMultiplePathVariables diff --git a/Examples/Sample_xEnvironment_RemovePathVariables.ps1 b/Examples/Sample_xEnvironment_RemovePathVariables.ps1 new file mode 100644 index 000000000..176eb7f55 --- /dev/null +++ b/Examples/Sample_xEnvironment_RemovePathVariables.ps1 @@ -0,0 +1,27 @@ +<# + .SYNOPSIS + Removes one or more values from the 'TestPathEnvironmentVariable' environment variable if the values exist. + Other values of the 'TestPathEnvironmentVariable' environment variable will not be modified. In this + example, the values 'C:\test456' and 'C:\test123' will be removed, but all other entries + will be left intact. In this example changes are made to applied the machine and the process. +#> +Configuration Sample_xEnvironment_Path_Remove +{ + param () + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xEnvironment RemovePathEnvironmentVariables + { + Name = 'TestPathEnvironmentVariable' + Ensure = 'Absent' + Path = $true + Value = "C:\test456;C;\test123" + Target = @('Process', 'Machine') + } + } +} + +Sample_xEnvironment_Path_Remove diff --git a/README.md b/README.md index 96e336c65..f93d980c9 100644 --- a/README.md +++ b/README.md @@ -401,9 +401,9 @@ None #### Parameters * **[String] Name** _(Key)_: The name of the environment variable to create, modify, or remove. -* **[String] Value** _(Write)_: The desired value for the environment variable. The default value is an empty string which either indicates that the variable should be removed entirely or that the value does not matter when testing its existence. +* **[String] Value** _(Write)_: The desired value for the environment variable. The default value is an empty string which either indicates that the variable should be removed entirely or that the value does not matter when testing its existence. Multiple entries can be entered and separated by semicolons (see [Examples](./Examples)). * **[String] Ensure** _(Write)_: Specifies if the environment varaible should exist. { *Present* | Absent }. -* **[Boolean] Path** _(Write)_: Indicates whether or not the environment variable is a path variable. If the variable being configured is a path variable, the value provided will be appended to or removed from the existing value, otherwise the existing value will be replaced by the new value. The default value is False. +* **[Boolean] Path** _(Write)_: Indicates whether or not the environment variable is a path variable. If the variable being configured is a path variable, the value provided will be appended to or removed from the existing value, otherwise the existing value will be replaced by the new value. When configured as a Path variable, multiple entries separated by semicolons are ensured to be either present or absent without affecting other Path entries (see [Examples](./Examples)). The default value is False. * **[String[]] Target** _(Write)_: Indicates the target where the environment variable should be set. { Process | Machine | *Process, Machine* }. #### Read-Only Properties from Get-TargetResource @@ -653,6 +653,8 @@ Publishes a 'FileInfo' object(s) to the pullserver configuration repository. It ### Unreleased +* xEnvironment path documentation update demonstrating usage with multiple values ([issue #415](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/415). [Alex Kokkinos (@alexkokkinos)](https://github.com/alexkokkinos) + ### 8.3.0.0 * Changes to xPSDesiredStateConfiguration From 28186040530799c39607da714bfb924db2bc55d2 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Mon, 18 Jun 2018 10:18:53 +0200 Subject: [PATCH 2/9] Activate the GitHub App Stale on the GitHub repository (#426) --- .github/stale.yml | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 000000000..84f3eaaa3 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,44 @@ +# Configuration for probot-stale - https://github.com/probot/stale + +limitPerRun: 30 + +pulls: + daysUntilStale: 14 + daysUntilClose: false + exemptProjects: true + exemptMilestones: true + staleLabel: abandoned + exemptLabels: + - needs review + - on hold + - waiting for CLA pass + + markComment: > + Labeling this pull request (PR) as abandoned since it has gone 14 days or more + since the last update. An abandoned PR can be continued by another contributor. + The abandoned label will be removed if work on this PR is taken up again. + +issues: + daysUntilStale: 30 + daysUntilClose: 40 + exemptProjects: true + exemptMilestones: true + staleLabel: stale + exemptLabels: + - bug + - enhancement + - tests + - documentation + - resource proposal + - on hold + + markComment: > + This issue has been automatically marked as stale because + it has not had activity from the community in the last 30 days. It will be + closed if no further activity occurs within 10 days. If the issue is labelled + with any of the work labels (e.g bug, enhancement, documentation, or tests) + then the issue will not auto-close. + + closeComment: > + This issue has been automatically closed because it is has not had activity + from the community in the last 40 days. From a5d60753a82ef5f816f0fa60aba5791b0e49ed83 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Mon, 18 Jun 2018 17:53:34 +0200 Subject: [PATCH 3/9] Opt-in for the common tests validate module files and script files (#427) - Changes to xPSDesiredStateConfiguration - Opt-in for the common tests validate module files and script files. - All files change to encoding UTF-8 (without byte order mark). --- .MetaTestOptIn.json | 4 + DSCResources/CommonResourceHelper.psm1 | 8 +- .../en-US/MSFT_xArchive.schema.mfl | Bin 5900 -> 2938 bytes .../en-US/MSFT_xArchive.strings.psd1 | 8 +- .../MSFT_xDSCWebService/PSWSIISEndpoint.psm1 | 306 +++++++++--------- .../en-US/MSFT_xDSCWebService.psd1 | 2 +- .../MSFT_xEnvironmentResource.schema.mfl | Bin 1522 -> 750 bytes .../MSFT_xEnvironmentResource.strings.psd1 | 2 +- .../en-US/MSFT_xGroupResource.schema.mfl | Bin 1694 -> 835 bytes .../MSFT_xMsiPackage/MSFT_xMsiPackage.psm1 | 34 +- .../en-US/MSFT_xMsiPackage.schema.mfl | Bin 4568 -> 2259 bytes .../en-US/MSFT_xMsiPackage.strings.psd1 | 4 +- .../en-US/MSFT_xScriptResource.schema.mfl | Bin 1936 -> 957 bytes .../en-US/MSFT_xScriptResource.strings.psd1 | 2 +- .../en-US/MSFT_xServiceResource.schema.mfl | Bin 2812 -> 1390 bytes .../en-US/MSFT_xUserResource.schema.mfl | Bin 2418 -> 1195 bytes .../en-US/MSFT_xUserResource.strings.psd1 | 2 +- .../en-US/MSFT_xWindowsFeature.schema.mfl | Bin 2160 -> 1067 bytes .../en-US/MSFT_xWindowsFeature.strings.psd1 | 2 +- .../MSFT_xWindowsOptionalFeature.schema.mfl | Bin 3260 -> 1614 bytes .../MSFT_xWindowsPackageCab.psm1 | 10 +- .../en-US/MSFT_xWindowsPackageCab.schema.mfl | 2 +- .../MSFT_xWindowsPackageCab.strings.psd1 | 2 +- .../en-US/MSFT_xWindowsProcess.schema.mfl | Bin 3574 -> 1766 bytes DSCResources/ResourceSetHelper.psm1 | 14 +- DSCResources/xGroupSet/xGroupSet.psd1 | 2 +- DSCResources/xGroupSet/xGroupSet.schema.psm1 | 4 +- DSCResources/xProcessSet/xProcessSet.psd1 | 2 +- .../xProcessSet/xProcessSet.schema.psm1 | 6 +- DSCResources/xServiceSet/xServiceSet.psd1 | 2 +- .../xServiceSet/xServiceSet.schema.psm1 | 6 +- .../xWindowsFeatureSet.psd1 | 2 +- .../xWindowsFeatureSet.schema.psm1 | 4 +- .../xWindowsOptionalFeatureSet.psd1 | 2 +- .../xWindowsOptionalFeatureSet.schema.psm1 | 4 +- ...ve_ExpandArchiveNoValidationCredential.ps1 | 4 +- .../Sample_xArchive_RemoveArchiveChecksum.ps1 | 2 +- ...ple_xArchive_RemoveArchiveNoValidation.ps1 | 6 +- ...cWebServiceRegistration_UseSQLProvider.ps1 | 24 +- ...ebServiceRegistration_Win2k12and2k12R2.ps1 | 24 +- ...nvironment_CreateMultiplePathVariables.ps1 | 4 +- ...ple_xEnvironment_CreateNonPathVariable.ps1 | 4 +- ...Sample_xEnvironment_CreatePathVariable.ps1 | 4 +- Examples/Sample_xEnvironment_Remove.ps1 | 4 +- ...ample_xEnvironment_RemovePathVariables.ps1 | 4 +- Examples/Sample_xGroupSet_AddMembers.ps1 | 4 +- Examples/Sample_xGroup_RemoveMembers.ps1 | 4 +- Examples/Sample_xGroup_SetMembers.ps1 | 4 +- Examples/Sample_xProcessSet_Start.ps1 | 2 +- Examples/Sample_xProcessSet_Stop.ps1 | 2 +- Examples/Sample_xRegistryResource_AddKey.ps1 | 2 +- ...ple_xRegistryResource_AddOrModifyValue.ps1 | 2 +- .../Sample_xRegistryResource_RemoveKey.ps1 | 2 +- .../Sample_xRegistryResource_RemoveValue.ps1 | 2 +- Examples/Sample_xScript.ps1 | 2 +- .../Sample_xServiceSet_BuiltInAccount.ps1 | 2 +- Examples/Sample_xServiceSet_StartServices.ps1 | 2 +- Examples/Sample_xUser_CreateUser.ps1 | 2 +- Examples/Sample_xUser_Generic.ps1 | 22 +- Examples/Sample_xWindowsFeature.ps1 | 14 +- .../Sample_xWindowsFeatureSet_Install.ps1 | 2 +- .../Sample_xWindowsFeatureSet_Uninstall.ps1 | 2 +- Examples/Sample_xWindowsOptionalFeature.ps1 | 2 +- ...ple_xWindowsOptionalFeatureSet_Disable.ps1 | 2 +- ...mple_xWindowsOptionalFeatureSet_Enable.ps1 | 2 +- Examples/Sample_xWindowsPackageCab.ps1 | 2 +- README.md | 3 + Tests/CommonTestHelper.psm1 | 14 +- Tests/DSCTestService.cs | 2 +- Tests/DSCTestServiceNew.cs | 2 +- .../MSFT_xArchive.EndToEnd.Tests.ps1 | 30 +- .../Integration/MSFT_xArchive.TestHelper.psm1 | 6 +- .../MSFT_xArchive_CredentialOnly.config.ps1 | 2 +- ...FT_xArchive_ValidateAndChecksum.config.ps1 | 2 +- .../MSFT_xArchive_ValidateOnly.config.ps1 | 2 +- ...FT_xEnvironmentResource.EndToEnd.Tests.ps1 | 56 ++-- ...xEnvironmentResource.Integration.Tests.ps1 | 106 +++--- .../MSFT_xEnvironmentResource.config.ps1 | 8 +- .../MSFT_xGroupResource.Integration.Tests.ps1 | 18 +- .../MSFT_xGroupResource_Members.config.ps1 | 2 +- ...esource_MembersToIncludeExclude.config.ps1 | 2 +- .../MSFT_xGroupResource_NoMembers.config.ps1 | 2 +- .../MSFT_xMsiPackage.EndToEnd.Tests.ps1 | 54 ++-- .../MSFT_xMsiPackage.Integration.Tests.ps1 | 6 +- .../Integration/MSFT_xMsiPackage_LogPath.ps1 | 2 +- .../MSFT_xMsiPackage_NoOptionalParameters.ps1 | 2 +- ...SFT_xPackageResource.Integration.Tests.ps1 | 2 +- .../MSFT_xRegistryResource.EndToEnd.Tests.ps1 | 20 +- ...FT_xRegistryResource.Integration.Tests.ps1 | 32 +- ...RegistryResource_KeyAndNameOnly.config.ps1 | 2 +- ...egistryResource_WithDataAndType.config.ps1 | 2 +- ...MSFT_xScriptResource.Integration.Tests.ps1 | 10 +- ...FT_xScriptResource_NoCredential.config.ps1 | 2 +- ..._xScriptResource_WithCredential.config.ps1 | 2 +- .../Integration/MSFT_xUserResource.config.ps1 | 22 +- ...MSFT_xWindowsFeature.Integration.Tests.ps1 | 12 +- .../MSFT_xWindowsFeature.config.ps1 | 16 +- ...ndowsOptionalFeature.Integration.Tests.ps1 | 10 +- .../MSFT_xWindowsOptionalFeature.config.ps1 | 2 +- ...T_xWindowsPackageCab.Integration.Tests.ps1 | 16 +- .../MSFT_xWindowsPackageCab.config.ps1 | 2 +- ...MSFT_xWindowsProcess.Integration.Tests.ps1 | 2 +- .../MSFT_xWindowsProcess.config.ps1 | 2 +- ...T_xWindowsProcessWithCredential.config.ps1 | 2 +- .../xGroupSet.Integration.Tests.ps1 | 16 +- Tests/Integration/xGroupSet.config.ps1 | 2 +- .../xProcessSet.Integration.Tests.ps1 | 6 +- Tests/Integration/xProcessSet.config.ps1 | 2 +- .../xServiceSet.Integration.Tests.ps1 | 8 +- ...viceSet_AllExceptBuiltInAccount.config.ps1 | 4 +- .../xServiceSet_BuiltInAccountOnly.config.ps1 | 2 +- .../xWindowsFeatureSet.Integration.Tests.ps1 | 10 +- .../Integration/xWindowsFeatureSet.config.ps1 | 2 +- ...wsOptionalFeatureSet.Integration.Tests.ps1 | 10 +- .../xWindowsOptionalFeatureSet.config.ps1 | 2 +- Tests/MSFT_xGroupResource.TestHelper.psm1 | 2 +- Tests/MSFT_xPackageResource.TestHelper.psm1 | 86 ++--- Tests/MSFT_xWindowsProcess.TestHelper.psm1 | 2 +- Tests/Unit/CommonResourceHelper.Tests.ps1 | 4 +- Tests/Unit/MSFT_xDSCWebService.Tests.ps1 | 88 ++--- .../Unit/MSFT_xEnvironmentResource.Tests.ps1 | 146 ++++----- Tests/Unit/MSFT_xMsiPackage.Tests.ps1 | 20 +- Tests/Unit/MSFT_xUserResource.TestHelper.psm1 | 2 +- Tests/Unit/MSFT_xWindowsPackageCab.Tests.ps1 | 16 +- Tests/Unit/ResourceSetHelper.Tests.ps1 | 10 +- Tests/WindowsProcessTestProcess.cs | 2 +- appveyor.yml | 3 +- 127 files changed, 764 insertions(+), 756 deletions(-) create mode 100644 .MetaTestOptIn.json diff --git a/.MetaTestOptIn.json b/.MetaTestOptIn.json new file mode 100644 index 000000000..baa2a30d7 --- /dev/null +++ b/.MetaTestOptIn.json @@ -0,0 +1,4 @@ +[ + "Common Tests - Validate Module Files", + "Common Tests - Validate Script Files" +] diff --git a/DSCResources/CommonResourceHelper.psm1 b/DSCResources/CommonResourceHelper.psm1 index b51d2f748..79e8b59ba 100644 --- a/DSCResources/CommonResourceHelper.psm1 +++ b/DSCResources/CommonResourceHelper.psm1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Tests if the current machine is a Nano server. #> @@ -9,7 +9,7 @@ function Test-IsNanoServer param () $isNanoServer = $false - + if (Test-CommandExists -Name 'Get-ComputerInfo') { $computerInfo = Get-ComputerInfo @@ -36,12 +36,12 @@ function Test-CommandExists { [OutputType([Boolean])] [CmdletBinding()] - param + param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] - $Name + $Name ) $command = Get-Command -Name $Name -ErrorAction 'SilentlyContinue' diff --git a/DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.schema.mfl b/DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.schema.mfl index fc681d9170f4ba9cbe228bd9d4b5f745801434c3..468ddd145f4811bb3d2fffcb054ec4047d6acf78 100644 GIT binary patch literal 2938 zcmc&$+fExX5Pi>AjPe9h8WmJ3wLFEJib_h=MCAb?WV{pB>aM-Ay@aUhzjwxa$?oRD zrAU1sB)j(b%*;7wd_5YUemkMR=>RS+k4G1$JN@zG_QU&6{oR|MOoVeVo}5i@A4gWk z>H*<1T#nCgkA%Y?=uB=U_I~#OuD{}9aDq-+m3d|KPJbFBWWvYb4S4!4$^bK!AUzNs zTx{|rf;$9!%!H0G;gw881_=sVDm(Yw-Qy`yP!DAL1s;c)-OOf z_-@frhC@bE^!gvqdV(oipp5QHB$R7}Gm$4A9z>EO5atT!TB4n5ms@;ElMP2!W$~#^ z0)iIGhBZ4dSF9T*s7Mhse^A-V^-70V6)%MJxk!=)q{7P>9lfN8(pV~TW^}}&2ib0WK1Ui6Z2{@H!Pz+6V1}6q;j_caT%qxmBJt^QMqHa5n)7=-&oL z!NsCFTaPOQjvd_JX~cjhdOQ(f&CzNWCsoYcKqwVGIOsl z8vy^?KlnHZe!xEt_V(A-Efy}WX5OYMt#}p%EbXdQ!IfBTaIhuL1~oO?-Vs%K@u*a@ zUQ^OyM6^^Q;T#1E%7T#6k{I!hNg6V{>8={2I67w&tdN`xo#KH literal 5900 zcmdT|+fEcg5Upnu|6$^jCQ6iuiTbqMA`!*78+jnaEW3kDTz1G_Kw|uL^_;3{dwQn&uH^JD6Byuh>#$Mrn4>NW!x~?l?`G}FJq%zmJvC8|d zpAlvs$XkqGLYGaQH^8h!&SZwqRK}`P4?9r$86?i|JHltGpZ30A(Bc?tN4kQuxh8@J zC#u6phIl&C(HIs`<{0l{eQ$D8$cykF%PH2-GOjtsn-p)jyX`y0>KOJX7)!EQlr+VR z1X8)PS+Sy68a^G!i2v+)2zg!1qt#>if~OCem9MXf(S>SBE1ET~NAKn^TgHC#gCc@? zH0nL2TR0K=tKnd0#&fmP9pjsR;m)$`3j@p;W1MHjnJG@$&#y<#{LRU&@)7UHA;Q!l zQSXT|uWgc2=V=kRNp{SE#Zcw6c|f%!+DbWOkg?loa~oJOR^_q0%+7*%F*1;wWa9){ zbBxi7T%!L^vol=58^b2gZGWb>Vb}HI%GFTmApV7zSUjU290R#Iq9;B69KT0+qW>7q zMLd}y7K>_IV9``_KrDZc%k)>%Iw|9L{se z*^Wm~Zr zDE{V^ZqKqT^21qdk-*m>%nYm(M%f%jkPG~#wh^QgZ_5>w5c-O@JbZ6H#B-SG3d{Zx zFr`$dr&S+TSxm4ebN>u~%rtiw;{+-|O>*5S1&X2$Ask$lp1J{~R>eVtw#jWL1jvRZ@r#66WGaB~e7M$IZl6{|tx zE_vzs{Xa%!vb_V=Ga8O_nTt_qf^J}*^$N_!tWFs9d~cMGV8$XMVsXr5vSKZtphe9x zpRHDQy;IR|+9P(}L)j-XYxv%16E-o%<+b)1$IdZ4`(3PHFSVaV$QadIl4ag<#TVA+ z&5SMklh0Q^_fprJ(V;0b(+4(SA^A#thUkQsMar+YjPvhtx(N;1Q0mGXu;qz7)0+$T zv?^=zLf^PL!;P$A=IRpu#w^c{tk~-<>r3sGmT4H)SA62R8z)@-M;~n0s|h*YcDQbd z(yDl0r4RkmWr6nWRLAz_TovAY6eHDgnTj_@WRLah39w{kXHkI}X0ExDHvp`>Sy9gs za~WBEg>N0?DWVMTx{OP963lY8j`1OXI#qZUYklAGJ0G=5u^fjOFWFbbnJugm7Vol* zg&_uuq1e^#+23W+!nUkER=@JM7W6{iU^%`}hE>qa13VpeJbc5BgQH=*ufxQj5A&P( zuIX;&7-#p-m4ma9=HEHmB{Dxy!lF-uwK^+LfLb v_A$kpyQ*5SRqRK2`?=@|Ie#@?kSk4?Ef-n5Rn1H&*1f(@GzR?0?j3#uHD4NC diff --git a/DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.strings.psd1 b/DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.strings.psd1 index f82caed1b..ed49b23cb 100644 --- a/DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.strings.psd1 +++ b/DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.strings.psd1 @@ -1,4 +1,4 @@ -# Localized MSFT_xArchive.strings.psd1 +# Localized MSFT_xArchive.strings.psd1 ConvertFrom-StringData @' RetrievingArchiveState = Retrieving the state of the archive with path {0} and destination {1}... @@ -13,10 +13,10 @@ ConvertFrom-StringData @' DestinationExists = A directory already exists at the destination path {0}. DestinationDoesNotExist = A directory does not exist at the destination path {0}. CreatingDirectoryAtDestination = Creating the root directory at the destination path {0}... - + TestingIfArchiveExistsAtDestination = Testing if the archive at the destination path {0} exists... ArchiveExistsAtDestination = The archive at path {0} exists at the destination {1}. - ArchiveDoesNotExistAtDestination = The archive at path {0} does not exist at the destination {1}. + ArchiveDoesNotExistAtDestination = The archive at path {0} does not exist at the destination {1}. OpeningArchive = Opening the archive at path {0}... ClosingArchive = Closing the archive at path {0}... @@ -43,7 +43,7 @@ ConvertFrom-StringData @' RemovingFile = Removing the file at path {0}... CouldNotRemoveItemOfIncorrectType = The file at {0} does not match the item type (file, directory, or other) or the archive entry at {1}, so it will not be removed. ArchiveRemovedFromDestination = Archive removed from the destination path {0}. - + ChecksumSpecifiedAndValidateFalse = The Checksum parameter was specified as {0} but the Validate parameter is set to false for the archive with path {1} and destination {2}. Please specify the Validate parameter as true to use the Checksum parameter. PathDoesNotContainValidPSDriveRoot = The path {0} cannot be accessed because it does not contain any directories to use as the root of a PSDrive. ErrorCreatingPSDrive = An error occurred while attempting to create a PSDrive to access the path {0} under the user {1}. diff --git a/DSCResources/MSFT_xDSCWebService/PSWSIISEndpoint.psm1 b/DSCResources/MSFT_xDSCWebService/PSWSIISEndpoint.psm1 index 86e6edb73..3a4033364 100644 --- a/DSCResources/MSFT_xDSCWebService/PSWSIISEndpoint.psm1 +++ b/DSCResources/MSFT_xDSCWebService/PSWSIISEndpoint.psm1 @@ -1,4 +1,4 @@ -# This module file contains a utility to perform PSWS IIS Endpoint setup +# This module file contains a utility to perform PSWS IIS Endpoint setup # Module exports New-PSWSEndpoint function to perform the endpoint setup # #Copyright (c) Microsoft Corporation, 2014 @@ -23,7 +23,7 @@ function Initialize-Endpoint $applicationPoolIdentityType, $svc, $mof, - $dispatch, + $dispatch, $asax, $dependentBinaries, $language, @@ -32,54 +32,54 @@ function Initialize-Endpoint $removeSiteFiles = $false, $certificateThumbPrint, $enable32BitAppOnWin64) - + if (!(Test-Path $cfgfile)) - { - throw "ERROR: $cfgfile does not exist" - } - + { + throw "ERROR: $cfgfile does not exist" + } + if (!(Test-Path $svc)) - { - throw "ERROR: $svc does not exist" - } - + { + throw "ERROR: $svc does not exist" + } + if (!(Test-Path $mof)) - { - throw "ERROR: $mof does not exist" + { + throw "ERROR: $mof does not exist" } - + if (!(Test-Path $asax)) - { - throw "ERROR: $asax does not exist" - } + { + throw "ERROR: $asax does not exist" + } if ($certificateThumbPrint -ne "AllowUnencryptedTraffic") - { + { Write-Verbose "Verify that the certificate with the provided thumbprint exists in CERT:\LocalMachine\MY\" $certificate = Get-childItem CERT:\LocalMachine\MY\ | Where {$_.Thumbprint -eq $certificateThumbPrint} - if (!$Certificate) - { + if (!$Certificate) + { throw "ERROR: Certificate with thumbprint $certificateThumbPrint does not exist in CERT:\LocalMachine\MY\" - } - } - + } + } + Test-IISInstall - + $appPool = "PSWS" - + Write-Verbose "Delete the App Pool if it exists" Remove-AppPool -apppool $appPool - + Write-Verbose "Remove the site if it already exists" Update-Site -siteName $site -siteAction Remove # check for existing binding, there should be no binding with the same port if ((Get-WebBinding | where bindingInformation -eq "*:$($port):").count -gt 0) { - throw "ERROR: Port $port is already used, please review existing sites and change the port to be used." + throw "ERROR: Port $port is already used, please review existing sites and change the port to be used." } - + if ($removeSiteFiles) { if(Test-Path $path) @@ -87,9 +87,9 @@ function Initialize-Endpoint Remove-Item -Path $path -Recurse -Force } } - + Copy-Files -path $path -cfgfile $cfgfile -svc $svc -mof $mof -dispatch $dispatch -asax $asax -dependentBinaries $dependentBinaries -language $language -dependentMUIFiles $dependentMUIFiles -psFiles $psFiles - + New-IISWebSite -site $site -path $path -port $port -app $app -apppool $appPool -applicationPoolIdentityType $applicationPoolIdentityType -certificateThumbPrint $certificateThumbPrint -enable32BitAppOnWin64 $enable32BitAppOnWin64 } @@ -99,18 +99,18 @@ function Test-IISInstall { Write-Verbose "Checking IIS requirements" $iisVersion = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\InetStp -ErrorAction silentlycontinue).MajorVersion - - if ($iisVersion -lt 7) + + if ($iisVersion -lt 7) { - throw "ERROR: IIS Version detected is $iisVersion , must be running higher than 7.0" - } - + throw "ERROR: IIS Version detected is $iisVersion , must be running higher than 7.0" + } + $wsRegKey = (Get-ItemProperty hklm:\SYSTEM\CurrentControlSet\Services\W3SVC -ErrorAction silentlycontinue).ImagePath if ($wsRegKey -eq $null) { - throw "ERROR: Cannot retrive W3SVC key. IIS Web Services may not be installed" - } - + throw "ERROR: Cannot retrive W3SVC key. IIS Web Services may not be installed" + } + if ((Get-Service w3svc).Status -ne "running") { throw "ERROR: service W3SVC is not running" @@ -127,7 +127,7 @@ function Test-IISSiteExists { return $true } - + return $false } @@ -140,29 +140,29 @@ function Update-Site [ValidateNotNullOrEmpty()] [String]$siteName, - [Parameter(ParameterSetName = 'Site', Mandatory, Position = 0)] + [Parameter(ParameterSetName = 'Site', Mandatory, Position = 0)] $site, [Parameter(ParameterSetName = 'SiteName', Mandatory, Position = 1)] [Parameter(ParameterSetName = 'Site', Mandatory, Position = 1)] [String]$siteAction) - + [String]$name = $null if ($PSCmdlet.ParameterSetName -eq 'SiteName') { $name = $siteName } elseif ($PSCmdlet.ParameterSetName -eq 'Site') - { + { $name = $site.Name } - + if (Test-IISSiteExists -siteName $name) { - switch ($siteAction) - { - "Start" {Start-Website -Name "$name"} - "Stop" {Stop-Website -Name "$name" -ErrorAction SilentlyContinue} + switch ($siteAction) + { + "Start" {Start-Website -Name "$name"} + "Stop" {Stop-Website -Name "$name" -ErrorAction SilentlyContinue} "Remove" {Remove-Website -Name "$name"} } Write-Verbose "p11" @@ -174,7 +174,7 @@ function Update-Site # function Remove-AppPool { - param ($appPool) + param ($appPool) # without this tests we may get a breaking error here, despite SilentlyContinue if (Test-Path "IIS:\AppPools\$appPool") @@ -199,44 +199,44 @@ function Copy-Files $path, $cfgfile, $svc, - $mof, + $mof, $dispatch, $asax, $dependentBinaries, $language, $dependentMUIFiles, - $psFiles) - + $psFiles) + if (!(Test-Path $cfgfile)) { - throw "ERROR: $cfgfile does not exist" + throw "ERROR: $cfgfile does not exist" } - + if (!(Test-Path $svc)) { - throw "ERROR: $svc does not exist" + throw "ERROR: $svc does not exist" } - + if (!(Test-Path $mof)) { - throw "ERROR: $mof does not exist" + throw "ERROR: $mof does not exist" } if (!(Test-Path $asax)) { - throw "ERROR: $asax does not exist" + throw "ERROR: $asax does not exist" } - + if (!(Test-Path $path)) { - $null = New-Item -ItemType container -Path $path + $null = New-Item -ItemType container -Path $path } - + foreach ($dependentBinary in $dependentBinaries) { if (!(Test-Path $dependentBinary)) { - throw "ERROR: $dependentBinary does not exist" + throw "ERROR: $dependentBinary does not exist" } } @@ -244,10 +244,10 @@ function Copy-Files { if (!(Test-Path $dependentMUIFile)) { - throw "ERROR: $dependentMUIFile does not exist" + throw "ERROR: $dependentMUIFile does not exist" } }#> - + Write-Verbose "Create the bin folder for deploying custom dependent binaries required by the endpoint" $binFolderPath = Join-Path $path "bin" $null = New-Item -path $binFolderPath -itemType "directory" -Force @@ -259,7 +259,7 @@ function Copy-Files if (!(Test-Path $muiPath)) { - $null = New-Item -ItemType container $muiPath + $null = New-Item -ItemType container $muiPath } Copy-Item $dependentMUIFiles $muiPath -Force }#> @@ -268,21 +268,21 @@ function Copy-Files { if (!(Test-Path $psFile)) { - throw "ERROR: $psFile does not exist" + throw "ERROR: $psFile does not exist" } - + Copy-Item $psFile $path -Force } - + Copy-Item $cfgfile (Join-Path $path "web.config") -Force Copy-Item $svc $path -Force Copy-Item $mof $path -Force - + if ($dispatch) { Copy-Item $dispatch $path -Force - } - + } + if ($asax) { Copy-Item $asax $path -Force @@ -295,24 +295,24 @@ function New-IISWebSite { param ( $site, - $path, + $path, $port, $app, - $appPool, + $appPool, $applicationPoolIdentityType, $certificateThumbPrint, - $enable32BitAppOnWin64) - + $enable32BitAppOnWin64) + $siteID = New-SiteID - + Write-Verbose "Adding App Pool" $null = New-WebAppPool -Name $appPool Write-Verbose "Set App Pool Properties" $appPoolIdentity = 4 if ($applicationPoolIdentityType) - { - # LocalSystem = 0, LocalService = 1, NetworkService = 2, SpecificUser = 3, ApplicationPoolIdentity = 4 + { + # LocalSystem = 0, LocalService = 1, NetworkService = 2, SpecificUser = 3, ApplicationPoolIdentity = 4 if ($applicationPoolIdentityType -eq "LocalSystem") { $appPoolIdentity = 0 @@ -320,19 +320,19 @@ function New-IISWebSite elseif ($applicationPoolIdentityType -eq "LocalService") { $appPoolIdentity = 1 - } + } elseif ($applicationPoolIdentityType -eq "NetworkService") { $appPoolIdentity = 2 - } - } + } + } $appPoolItem = Get-Item IIS:\AppPools\$appPool $appPoolItem.managedRuntimeVersion = "v4.0" $appPoolItem.enable32BitAppOnWin64 = $enable32BitAppOnWin64 $appPoolItem.processModel.identityType = $appPoolIdentity $appPoolItem | Set-Item - + Write-Verbose "Add and Set Site Properties" if ($certificateThumbPrint -eq "AllowUnencryptedTraffic") { @@ -349,7 +349,7 @@ function New-IISWebSite $null = Get-Item CERT:\LocalMachine\MY\$certificateThumbPrint | New-Item IIS:\SSLBindings\0.0.0.0!$port } - Update-Site -siteName $site -siteAction Start + Update-Site -siteName $site -siteAction Start } # Allow Clients outsite the machine to access the setup endpoint on a User Port @@ -357,37 +357,37 @@ function New-IISWebSite function New-FirewallRule { param ($firewallPort) - - $script:netsh = "$env:windir\system32\netsh.exe" + + $script:netsh = "$env:windir\system32\netsh.exe" Write-Verbose "Disable Inbound Firewall Notification" & $script:netsh advfirewall set currentprofile settings inboundusernotification disable # remove all existing rules with that displayName & $script:netsh advfirewall firewall delete rule name=DSCPullServer_IIS_Port protocol=tcp localport=$firewallPort | Out-Null - + Write-Verbose "Add Firewall Rule for port $firewallPort" - & $script:netsh advfirewall firewall add rule name=DSCPullServer_IIS_Port dir=in action=allow protocol=TCP localport=$firewallPort + & $script:netsh advfirewall firewall add rule name=DSCPullServer_IIS_Port dir=in action=allow protocol=TCP localport=$firewallPort } # Enable & Clear PSWS Operational/Analytic/Debug ETW Channels # function Enable-PSWSETW -{ +{ # Disable Analytic Log - & $script:wevtutil sl Microsoft-Windows-ManagementOdataService/Analytic /e:false /q | Out-Null + & $script:wevtutil sl Microsoft-Windows-ManagementOdataService/Analytic /e:false /q | Out-Null # Disable Debug Log - & $script:wevtutil sl Microsoft-Windows-ManagementOdataService/Debug /e:false /q | Out-Null + & $script:wevtutil sl Microsoft-Windows-ManagementOdataService/Debug /e:false /q | Out-Null # Clear Operational Log - & $script:wevtutil cl Microsoft-Windows-ManagementOdataService/Operational | Out-Null + & $script:wevtutil cl Microsoft-Windows-ManagementOdataService/Operational | Out-Null # Enable/Clear Analytic Log - & $script:wevtutil sl Microsoft-Windows-ManagementOdataService/Analytic /e:true /q | Out-Null + & $script:wevtutil sl Microsoft-Windows-ManagementOdataService/Analytic /e:true /q | Out-Null # Enable/Clear Debug Log - & $script:wevtutil sl Microsoft-Windows-ManagementOdataService/Debug /e:true /q | Out-Null + & $script:wevtutil sl Microsoft-Windows-ManagementOdataService/Debug /e:true /q | Out-Null } <# @@ -403,42 +403,42 @@ function New-PSWSEndpoint { [CmdletBinding()] param ( - - # Unique Name of the IIS Site + + # Unique Name of the IIS Site [String] $site = "PSWS", - - # Physical path for the IIS Endpoint on the machine (under inetpub) + + # Physical path for the IIS Endpoint on the machine (under inetpub) [String] $path = "$env:SystemDrive\inetpub\PSWS", - - # Web.config file + + # Web.config file [String] $cfgfile = "web.config", - - # Port # for the IIS Endpoint + + # Port # for the IIS Endpoint [Int] $port = 8080, - - # IIS Application Name for the Site + + # IIS Application Name for the Site [String] $app = "PSWS", - + # IIS App Pool Identity Type - must be one of LocalService, LocalSystem, NetworkService, ApplicationPoolIdentity [ValidateSet('LocalService', 'LocalSystem', 'NetworkService', 'ApplicationPoolIdentity')] [String] $applicationPoolIdentityType, - - # WCF Service SVC file + + # WCF Service SVC file [String] $svc = "PSWS.svc", - + # PSWS Specific MOF Schema File [parameter(Mandatory)] [ValidateNotNullOrEmpty()] [String] $mof, - + # PSWS Specific Dispatch Mapping File [Optional] [ValidateNotNullOrEmpty()] - [String] $dispatch, - + [String] $dispatch, + # Global.asax file [Optional] [ValidateNotNullOrEmpty()] [String] $asax, - + # Any dependent binaries that need to be deployed to the IIS endpoint, in the bin folder [ValidateNotNullOrEmpty()] [String[]] $dependentBinaries, @@ -450,28 +450,28 @@ function New-PSWSEndpoint # Any dependent binaries that need to be deployed to the IIS endpoint, in the bin\mui folder [Optional] [ValidateNotNullOrEmpty()] [String[]] $dependentMUIFiles, - + # Any dependent PowerShell Scipts/Modules that need to be deployed to the IIS endpoint application root [ValidateNotNullOrEmpty()] [String[]] $psFiles, - + # True to remove all files for the site at first, false otherwise [Boolean]$removeSiteFiles = $false, - # Enable Firewall Exception for the supplied port + # Enable Firewall Exception for the supplied port [Boolean] $EnableFirewallException, - # Enable and Clear PSWS ETW + # Enable and Clear PSWS ETW [switch] $EnablePSWSETW, - + # Thumbprint of the Certificate in CERT:\LocalMachine\MY\ for Pull Server [String] $certificateThumbPrint = "AllowUnencryptedTraffic", # When this property is set to true, Pull Server will run on a 32 bit process on a 64 bit machine [boolean]$Enable32BitAppOnWin64 = $false) - + $script:wevtutil = "$env:windir\system32\Wevtutil.exe" - + $svcName = Split-Path $svc -Leaf $protocol = "https:" if ($certificateThumbPrint -eq "AllowUnencryptedTraffic") @@ -481,7 +481,7 @@ function New-PSWSEndpoint # Get Machine Name $cimInstance = Get-CimInstance -ClassName Win32_ComputerSystem -Verbose:$false - + Write-Verbose ("Setting up endpoint at - $protocol//" + $cimInstance.Name + ":" + $port + "/" + $svcName) Initialize-Endpoint -site $site -path $path -cfgfile $cfgfile -port $port -app $app ` -applicationPoolIdentityType $applicationPoolIdentityType -svc $svc -mof $mof ` @@ -489,7 +489,7 @@ function New-PSWSEndpoint -language $language -dependentMUIFiles $dependentMUIFiles -psFiles $psFiles ` -removeSiteFiles $removeSiteFiles -certificateThumbPrint $certificateThumbPrint ` -enable32BitAppOnWin64 $Enable32BitAppOnWin64 - + if ($EnableFirewallException -eq $true) { Write-Verbose "Enabling firewall exception for port $port" @@ -499,7 +499,7 @@ function New-PSWSEndpoint if ($EnablePSWSETW) { Enable-PSWSETW - } + } } <# @@ -509,16 +509,16 @@ function New-PSWSEndpoint Removes a PSWS IIS Endpoint .EXAMPLE Remove the endpoint with the specified name - Remove-PSWSEndpoint -siteName PSDSCPullServer + Remove-PSWSEndpoint -siteName PSDSCPullServer #> function Remove-PSWSEndpoint { [CmdletBinding()] - param ( - # Unique Name of the IIS Site + param ( + # Unique Name of the IIS Site [String] $siteName ) - + # get the site to remove $site = Get-Item -Path "IIS:\sites\$siteName" # and the pool it is using @@ -528,14 +528,14 @@ function Remove-PSWSEndpoint $filePath = $site.PhysicalPath # get the port number for the Firewall rule $bindings = (Get-WebBinding -Name $siteName).bindingInformation - $port = [regex]::match($bindings,':(\d+):').Groups[1].Value + $port = [regex]::match($bindings,':(\d+):').Groups[1].Value # remove the actual site. Remove-Website -Name $siteName # there may be running requests, wait a little # I had an issue where the files were still in use # when I tried to delete them - Start-Sleep -Milliseconds 200 + Start-Sleep -Milliseconds 200 # remove the files for the site If (Test-Path $filePath) @@ -545,8 +545,8 @@ function Remove-PSWSEndpoint } # find out whether any other site is using this pool - $filter = "/system.applicationHost/sites/site/application[@applicationPool='" + $pool + "']" - $apps = (Get-WebConfigurationProperty -Filter $filter -PSPath "machine/webroot/apphost" -name path).ItemXPath + $filter = "/system.applicationHost/sites/site/application[@applicationPool='" + $pool + "']" + $apps = (Get-WebConfigurationProperty -Filter $filter -PSPath "machine/webroot/apphost" -name path).ItemXPath if ($apps.count -eq 1) { # if we are the only site in the pool, remove the pool as well. @@ -570,57 +570,57 @@ function Remove-PSWSEndpoint function Set-AppSettingsInWebconfig { param ( - + # Physical path for the IIS Endpoint on the machine (possibly under inetpub) [parameter(Mandatory)] [ValidateNotNullOrEmpty()] [String] $path, - + # Key to add/update [parameter(Mandatory)] [ValidateNotNullOrEmpty()] [String] $key, - # Value + # Value [parameter(Mandatory)] [ValidateNotNullOrEmpty()] [String] $value ) - + $webconfig = Join-Path $path "web.config" [bool] $Found = $false if (Test-Path $webconfig) { $xml = [xml](get-content $webconfig) - $root = $xml.get_DocumentElement() + $root = $xml.get_DocumentElement() - foreach( $item in $root.appSettings.add) - { - if( $item.key -eq $key ) - { - $item.value = $value; + foreach( $item in $root.appSettings.add) + { + if( $item.key -eq $key ) + { + $item.value = $value; $Found = $true; - } + } } if( -not $Found) { - $newElement = $xml.CreateElement("add") - $nameAtt1 = $xml.CreateAttribute("key") - $nameAtt1.psbase.value = $key; + $newElement = $xml.CreateElement("add") + $nameAtt1 = $xml.CreateAttribute("key") + $nameAtt1.psbase.value = $key; $null = $newElement.SetAttributeNode($nameAtt1) - - $nameAtt2 = $xml.CreateAttribute("value") - $nameAtt2.psbase.value = $value; - $null = $newElement.SetAttributeNode($nameAtt2) - - $null = $xml.configuration["appSettings"].AppendChild($newElement) + + $nameAtt2 = $xml.CreateAttribute("value") + $nameAtt2.psbase.value = $value; + $null = $newElement.SetAttributeNode($nameAtt2) + + $null = $xml.configuration["appSettings"].AppendChild($newElement) } } - $xml.Save($webconfig) + $xml.Save($webconfig) } <# @@ -640,7 +640,7 @@ function Set-AppSettingsInWebconfig function Set-BindingRedirectSettingInWebConfig { param ( - + # Physical path for the IIS Endpoint on the machine (possibly under inetpub) [parameter(Mandatory)] [ValidateNotNullOrEmpty()] @@ -649,11 +649,11 @@ function Set-BindingRedirectSettingInWebConfig # old version of the assembly [String] $oldVersion = "10.0.0.0", - # new version to redirect to + # new version to redirect to [String] $newVersion = "6.3.0.0" ) - + $webconfig = Join-Path $path "web.config" if (Test-Path $webconfig) @@ -707,7 +707,7 @@ function Set-BindingRedirectSettingInWebConfig # The section goes inside section $xml.configuration.AppendChild($runtimeSetting) - $xml.Save($webconfig) + $xml.Save($webconfig) } } } diff --git a/DSCResources/MSFT_xDSCWebService/en-US/MSFT_xDSCWebService.psd1 b/DSCResources/MSFT_xDSCWebService/en-US/MSFT_xDSCWebService.psd1 index bc2bb27c7..32e75b7b9 100644 --- a/DSCResources/MSFT_xDSCWebService/en-US/MSFT_xDSCWebService.psd1 +++ b/DSCResources/MSFT_xDSCWebService/en-US/MSFT_xDSCWebService.psd1 @@ -1,4 +1,4 @@ -# culture="en-US" +# culture="en-US" ConvertFrom-StringData -StringData @' ThrowCertificateThumbprint = CertificateThumbprint must contain a certificate thumbprint, or "AllowUnencryptedTraffic" to opt-out from being secure. ThrowUseSecurityBestPractice = Error: Cannot use best practice security settings with unencrypted traffic. Please set UseSecurityBestPractices to $false or use a certificate to encrypt pull server traffic. diff --git a/DSCResources/MSFT_xEnvironmentResource/en-US/MSFT_xEnvironmentResource.schema.mfl b/DSCResources/MSFT_xEnvironmentResource/en-US/MSFT_xEnvironmentResource.schema.mfl index d3524d3cde9ee1448a670422970838095d667845..d61dd894a5258c07508b145e1350ebd81e56234f 100644 GIT binary patch literal 750 zcmaKpPiw+J5XJBL6hlr5w)D_T^`tcgsnODeUPNTwjAkI&mEBELO22z2v4U-q9+rju z^WOWtSxwPOLkCA%_53(RI0dRCqg9T|fkCSaBM}Zpmz1Cd0XfQ4D6%;?4Y^QakG#p0 z6y6>A4d9JHDGZ5ihW6g?!w|--nqV>*hrwdXD;~gn`8=KnJwJ>#j}K3Nf9=UkSPNnF z5^rw9ykD~nVHwUg6JhassjjjNB+W?aMntBr6m*K4Rz!cjI_G(3PAQ!cZSHxW zuk*2eeKv575HUKKppP*UUPp+qk3H1U=v-D&x#>q3F~yCSb%4%)|2x3jDGut0tkC8G+88h^#xXZP zVCQrGU)tozcIo1f&lO_1BW8cEGv-i66<0hf^GvuasG)^ZoZ!rQHJP)E9d0(@oS1*k za&E{_>rZwbY?~}M+NjFP5~~W0xxgeM83f2$&PYs`^~5q;pO zkH>M5;bAj+?>Bigq~4Bx4XD@D_?Y9`mXU3?e*Br2Z|~X?TXL>5=JM(mFxz`xJoikc zfgum+NxfysR;(8@dgen=VnvseI;qA&Am@aftgD>l{S@);o#VeK`5h@73r6m3l3cm^ z-mh1x!1*KlKFGrk^FIH_Id_u$J+ZHs@Okud;9}?eSeI37TbJ0_T#s(~?Wt!rYM=>^ I@gu!|1Aqz%BLDyZ diff --git a/DSCResources/MSFT_xEnvironmentResource/en-US/MSFT_xEnvironmentResource.strings.psd1 b/DSCResources/MSFT_xEnvironmentResource/en-US/MSFT_xEnvironmentResource.strings.psd1 index d1d097fcc..e8ce88704 100644 --- a/DSCResources/MSFT_xEnvironmentResource/en-US/MSFT_xEnvironmentResource.strings.psd1 +++ b/DSCResources/MSFT_xEnvironmentResource/en-US/MSFT_xEnvironmentResource.strings.psd1 @@ -1,4 +1,4 @@ -# Localized resources for MSFT_xEnvironmentResource +# Localized resources for MSFT_xEnvironmentResource ConvertFrom-StringData @' ArgumentTooLong = Argument is too long. diff --git a/DSCResources/MSFT_xGroupResource/en-US/MSFT_xGroupResource.schema.mfl b/DSCResources/MSFT_xGroupResource/en-US/MSFT_xGroupResource.schema.mfl index a9784482fc0f6c7b93239de11cca847fdc6be7a7..51504000c1c945b6b8f74ac3e1b7826e5da44b1a 100644 GIT binary patch literal 835 zcmb7?L2JS=6vyxV6px-1y0OD9(^IG2kXePEb0@ zHxBQu!T{#!Wc|zxwpYPt0I+<+Lv-PQRJxQWpj7t?HZJ{JNH|` z!fK%kIF4ZEKto^Vti(idkvonmJ8dN<{E7ajc{ zbjkj*?f6~#dagwIf!f@{Oq(yu)r~}<@~Zx|_EYaa(2OR{tDEV#{|`NBUR|TdJ_#I^ f6)vLT_I>Ll@kN@PaUBoEa$7Y=}vS&6A z9i9gK-(`jlvke&$@GN1REIR98V9`F$y4?A+41Vjx+zE$b9EyZKk;NoD4QW-ibK*SV z{+i!{)eP;thg0sWD51s<-EV_u9xAA#NLz(Aby>wT+PK68t}Iszhd3Z2pY>vXJoC6G z8|@SmPuA-y55iEVcbT5I7Tw3XmvVnt1&`iMJTl8WaqYeZF(yvM%PZFfFH6oA{OT_I z^iH^{AjPewu2vzhVwLF;sB5DE=4)g&bwDC^tZP#meFF;!L-#hCYM&44Y zJ|v11?>T4AoSF5_F`7h+(uzV&#_J5>acRVgCEr+zpwSdgCkVoTGswXfkTd1~TE=tO z3W;Waya%5k%29FT(`b2eeoUYB6c!h=XmK(bFXOv+Z$6IqZbyk^#?Z;r^M$q`0h~dpnV2xM#9Uwn7+(gh^_Vr zD_wAx*f~G+gafjY*=!0|mkTH~T%FGd%VypLOGdqjOV14<=ZcGjSv2sFAwg&lb)t;Z zNQlh#VZG%m@}H{pqft95sw>A>PMb0|V zFlpN=S=8W#v!x?1w-pt|H(1G{NLRt$dGGMC#Kh7VWXxnhW;kr|{3yVdis2ws#o%E; z7SwMt@Y#@b={u!EX9N{4fXTGb!e)6F@Dvql%1?#g9iGTz(O<|Sh)&ee4VVSI+V3sny4_}1j3DewA z>?nFt77xh7Uc?n{Tr-Dd^*L=uvtLq3EzOc3ZT}%NXj83c-O&sst*96sXDB5k1;?&S zlncRqm*RNQ_sMvp&erQy3{Fd+x$`AgJJo0954NDbM?HIT`?^M_OwGv84ehp}GN0A{ z%uy<-WwlQ<_1e`570OV*WEIe$2bWGo=5KSxg()T5fns?#4b1`;RNYHk@|=!@)wjdz z6ZcB6d0kChU07k%sw>^19pb_RGeCEg1w*!rgyhqT60|EDtH2{nYbTNV;+Hh}hdO9q zqX_wh3hOcA#|xJEMY244j(jy&_U!@0bTAA_qKseI&DGd!yJ4x%VVm3Vx;`96=1(sQ k?Zm$lwt1WA-L7GV(ru(L{#x`m!#}is)gC+?{W=`|2HvL;vH$=8 literal 4568 zcmc(jNpBND5QXcE#D5rZ3Q~j+n*^Lp5=2BoEbPDmp~#7s7`!odSjArl-q$tFcn#B_ z2q9;d?yi3I>Q!|OKYzTjUF+D?&MddSO>CyWV;k9)-LR&eYb>+RcBmPBt6NL+-s^8K zywAhRv0Z5GS$NaeyiCtiJ+*Z=lda5#S~2>)>d+dtueV)U90UuuwAW3&d8A)WvpbsI z4i>icd}w?2LMZ*(v~A5gup`^i*n!4Cip>+dXSeNPu=Q4RuG=-C8ff2XK*gM=^66xw zKkR=bTl<>xB&_S$%Yd--5v$*V?M$=Z*mI445vD)0*bhF90>fRc>C4NWY>dR$&`xD1 z*V8h07aH%|2fgpemoJ*JYzLOl^%mwQLS05^6RWV(&?+MC80xwo3*UuS&*XpG9?$vs zXW!Tt6vXCOoE_*o4*nb~b~^tmG#y_6bi=^2h=1&J)c%utMcl;?v4A8RW}(>$f3 z;f2SfA9g2J^WK)()-7TNQgRM2JU62Et4iL|oUSakq~eKubA6rauA_QZJ^OanAWic% z=3n$~ATOvb5j#H3gpt3*1=MlO>v46o2f=n-USlB*XGgVnB6g@UuCR02naWO9=z}`9 zj4+-QoEaV+&KBZRdJ*wtVt-uZxu0a4PnXradMc|#?^%H=%{%nn)9&O1+zf@URG90I zlXIkB9{7tjhU@a)^Nifmcoxo>vVN3WZU}G9?$~{Mkf6HgV{HX>n%7jzQ+p?$h^j}# zYvwR`&pSGRnZ~{Td*!F2=oMUK8iNzEj%dd^y{rW4OHaR<>PUCBnrzpldfr+r9ZkXegf)AMcKYUiN4D$>% z*LYKnr+N{cTs;a(AztW%{)7lFXOy2SbVaCu84dlT16j{BYVZp9Ox<8pr*I=!&BH$4 zEk>I|oP`HpEgy~===ulMDz%5?0P;a&W8d==sycTPi1MOyv8hpWwNDtTEC hcGn_E^MbybuAeGJC8Ea0?}@9)|N6>~j`(|_?qBd+6#4)F diff --git a/DSCResources/MSFT_xMsiPackage/en-US/MSFT_xMsiPackage.strings.psd1 b/DSCResources/MSFT_xMsiPackage/en-US/MSFT_xMsiPackage.strings.psd1 index ccb921209..b45ad9850 100644 --- a/DSCResources/MSFT_xMsiPackage/en-US/MSFT_xMsiPackage.strings.psd1 +++ b/DSCResources/MSFT_xMsiPackage/en-US/MSFT_xMsiPackage.strings.psd1 @@ -1,4 +1,4 @@ -# Localized resources for MSFT_xMsiPackage +# Localized resources for MSFT_xMsiPackage ConvertFrom-StringData @' CheckingFileHash = Checking file '{0}' for expected {2} hash value of {1} @@ -40,5 +40,5 @@ ConvertFrom-StringData @' ThePathExtensionWasPathExt = The path extension was {0} TheUriSchemeWasUriScheme = The uri scheme was {0} WrongSignerSubject = File '{0}' was not signed by expected signer subject '{1}' - WrongSignerThumbprint = File '{0}' was not signed by expected signer certificate thumbprint '{1}' + WrongSignerThumbprint = File '{0}' was not signed by expected signer certificate thumbprint '{1}' '@ diff --git a/DSCResources/MSFT_xScriptResource/en-US/MSFT_xScriptResource.schema.mfl b/DSCResources/MSFT_xScriptResource/en-US/MSFT_xScriptResource.schema.mfl index 6e031a66d5b6159b85939fcc703cf8a624e63f4b..5b199db2c35a62f585314f17e42a793411febb67 100644 GIT binary patch literal 957 zcmcJOL2KJU5QXph6%U^h5TS=&8lPM{Ev0c%BHhwpHoIeMskCcmc9WXY|K5=lyD{~l zmk0#X!pwa0-rM^HiDkb{K8CYN-FN|$#LSkU-&x2ZMQn-Jkvn{*RHC8;6C7%igmn(K zFE*`DJH&w05Ej)Ooe5^6)gd|(J>{4;4Zg)^Vri&tG0v3>d=HazTw>NyaOBF_^6F-x zZ(ZX0c0RklI-7K|djIajGUU}2*jnb4ejI}YVg{lzeahwbRL)KU_{2GC@(w&xT ue(3t*=N%bW;-Bdnirnh8;n)pZ9%ArvAI6NGp0V(lW<{-8%w8s(aJxF)$4!#ydT=N9JPwWNRU)mR> zK8iCu4H;G(r`W&3_F4SCuw5&me~mr@)_TtEHArjX8?WmGJ8`dym+<7QrR)SEQiXzj z042cUu)d17z@mxT6pNnUWQ1Q~EvQ0fpRiXg-II_!hQh9q#ZFi0ES@x3l?Op8lg;s!Gj(!ChX&m^!p$*!yK3>!}{nd2ohr!=QKd z|G?li*=z3P8y0jLZ{mq|#wymDYCdgrCOangnf95f-s-LX4&U9>{1fBjeLs!)sK*tv zB2stFW9G_kyRW?Sm2ZlDhE`MB^VT`4;=0eTj;MZvXm0rI)c5mp zN56@6w@c4JPUD=`9ie&9&(+~=rkUpTYN@uexnjMFcU4!<{i!g#FSh5|Z8ABAiJBWy Rcfp#wB#n2B=km?`{S&t%PMZJ# diff --git a/DSCResources/MSFT_xScriptResource/en-US/MSFT_xScriptResource.strings.psd1 b/DSCResources/MSFT_xScriptResource/en-US/MSFT_xScriptResource.strings.psd1 index ade8a7197..c6e357706 100644 --- a/DSCResources/MSFT_xScriptResource/en-US/MSFT_xScriptResource.strings.psd1 +++ b/DSCResources/MSFT_xScriptResource/en-US/MSFT_xScriptResource.strings.psd1 @@ -1,4 +1,4 @@ -# Localized MSFT_xScriptResource.strings.psd1 +# Localized MSFT_xScriptResource.strings.psd1 ConvertFrom-StringData @' GetTargetResourceStartVerboseMessage = Begin executing get script. diff --git a/DSCResources/MSFT_xServiceResource/en-US/MSFT_xServiceResource.schema.mfl b/DSCResources/MSFT_xServiceResource/en-US/MSFT_xServiceResource.schema.mfl index 989970f91ea29d8d244da0130f45bab9104ef19f..bfd46582ad788d44a88881980f48a4cbc3829293 100644 GIT binary patch literal 1390 zcmbVMO;6)65WV+TjCum8LVMWD!YRk$1c{B4~=0kGA%En8hFZ#1eIwZUbu+mDF_gte>`jd=yk-Q2rC(S?As~4d=#ll4$Ok z%eR;wjexsG>%niDNF)p1)aa#Xt4>e{RPAvn9WK>>*jOK$83TQr(=tfqL25uDOwdg0 zu&X#d78EPSGSRUSsPc{TRJZ)P_f8+}#gzQJv8%0Q+NHPr(j^-Qy literal 2812 zcmc&$U2oGs5S(Wu{)5F6NT}k07vRbLK&q6aRg*d$Y51yZ-s(632*ox78t$(Km`H*%t z#IV{%A$3(ArI^Tcwxaa`zHs$oZ^xq{yQbxas0%!Ce_)nlj#8ej(-oJW@6M?_I9~oG ztIbM~GK41MuNZo;xEv=TV^^%=OLsJ?MLXo2vaFm|930as=iHpL&tpe;HpDV15&aLQ z=0uQK_N6*0NV54TaC5^J~%QvvuoqD|{_?x=@9e4pb4eqFJ%hrbTyecX{g` z$x*{;{UX?{lKyT;iFs=u`MqZP`>kEiJAYyKX-(El>))@{H^t|z-Q#;3IqvngG2?eXPThG`ff?(7G^~uM zOBCioT|`~fRSMS?-8+Dob8i9(ZS|&*8b7)Psm)ZL#PQ!c{JEhJI#;{fJABCgRoSVg V>J6cLUQTG8Q*nyg>E)?>{sO>j=-dDR diff --git a/DSCResources/MSFT_xUserResource/en-US/MSFT_xUserResource.schema.mfl b/DSCResources/MSFT_xUserResource/en-US/MSFT_xUserResource.schema.mfl index 92809e05005678b0cda60bd15d840e353532144a..4000f0c24f3ca644a0d27915622a5cc1a8f389e2 100644 GIT binary patch literal 1195 zcmbVLO-~y!5WVMDjP^p1Rt<+<3a2GmBvdvalC}qgqKQ3WEqU$K_L3mPfA84&D2Wn; zI9R)~J@37F^ZYO%FPxeOWlc95*UEzxtxGLmFoRON8MYn;Q)ZNIoFyID1wd_VhUwgC zo;F*Z*ABqLPkPB=PauK8hQQ7s)C3VG>gzkgK)uRJHGAm|NK>Hq!X9B1oH9?TV8{R$ z5&w@HXJ70 zv^1n=a^urNT)8oZ`eqF`ThC*w* KAlC7A(fJ4d8J)QR literal 2418 zcmc&#O;6iE6r6LV{)bgAr4k}N^wRbeQjkzdK!w5qA(S|#jb!Z94p3C_*MXV0b~ZR9 zf}|?4{IR=l-^aY!@%`Niz9L3}2swrrVa#WS6l-YU5WhGo;J7B6443?h`0dL1OU}j^ za6IO!!v%WW+rv+@NjMjAlyJpc=KSh$E;3&!cNN%Rr1zZv%)3PoF+B{->pI6BY@y2> z{reE>wA#fU+FaY^n)2-60B87!5BOxhPVp9R7$ae56wwzDT{Q2>-f+`Un5!$@Tv0J@Yy#B~&N;|JUOq`&m3zskl8A oMSszd)$4TJ@ieOHX8HC#)$IR9qibwxnPO*TskFoM;I@1}0CgvzUjP6A diff --git a/DSCResources/MSFT_xUserResource/en-US/MSFT_xUserResource.strings.psd1 b/DSCResources/MSFT_xUserResource/en-US/MSFT_xUserResource.strings.psd1 index aff537e01..ca1bdff82 100644 --- a/DSCResources/MSFT_xUserResource/en-US/MSFT_xUserResource.strings.psd1 +++ b/DSCResources/MSFT_xUserResource/en-US/MSFT_xUserResource.strings.psd1 @@ -1,4 +1,4 @@ -# Localized resources for xUser +# Localized resources for xUser ConvertFrom-StringData @' UserWithName = User: {0} diff --git a/DSCResources/MSFT_xWindowsFeature/en-US/MSFT_xWindowsFeature.schema.mfl b/DSCResources/MSFT_xWindowsFeature/en-US/MSFT_xWindowsFeature.schema.mfl index 950c2f25877366cd1d5ae7da9b129c2ff3a22aa1..f34f4c2ebc973229d341dd683401c5af598799eb 100644 GIT binary patch literal 1067 zcmb7DO>5gg5WVYH3_c|wLJzsLIVrXSCUz1cK@K69m3Cw;tY+2SRZ~;?-#aU*vaPs* z3Ir>Od0+GNx>-Cd8)2#=f9_EtE29+XDEBH-)w9``X!3?Y!H5lq=B3Q~`h z9$5=-M{_4a-yro?(GDIM=%#0SvC89wD{Zh)rDFT<6|#MMmeEzF)e>@!x6hQbIi^N= z1=$#Q2QkDNgG0|RcrA@J4O+hs`ky#(B;QSq2F}gl$ykziQ^y+_jV{UY8vom>Yx6?` z`n+qQ=x;4xur9PSC;lgC-x^+$AXrhMTZxI*X`2tr|3p*9g=>VbLMEYn+U%fIyl#FD z=PtMqn+RQ>a1I+@o81#be8Q4IVNr74O7P#HN+9G%8UL$Eos>!Im^+4LoulN*RcHYf z7|PFOpO5HgH*@$rXnaP&{Us}gc(2&iYRO7vLo4_ku(DvKxtg$B`k8O+=6HO-ZpQh-qa-}dSh?kGh%d!dbgh^C zR-h7sj`i)B|F7JwF5 zD(Of4foXn~Cn0&@Oi3j)2fRLM*vTv4i&WXc?^JL_8YH~9$ zDDZDHZ|xouZ-AF|t}jtEd8_O+BUOzv%+r+YC!X1i9q~WR&w0&takW~BwTWflc;Z4^ zwA4n9EyQY@md&1aK{v1G@+tbNSfj0au*z}ifV#P^9IF3n-=$5Oxdfl8&L#tP^ZSUi zL93)=3G-aKA}m~WQoI+;fDkto;IWk&)Ot51KQTRWC9=K%jV4X=Aq9>5ab0$Sb&+xM z6I6b8rp-z2d7Sea#bdKc!Kb@MvlLi9#$&iEG~?2+yxx^k$84HiYS*UaT2hKhkWgVk3o8x?txP-+tBxJn&a$ZLfA82yNT48f zkw7N#ym{}<$7YB&HX?IEt4@2B2nzI1{pHgf1v%rBmib`)dPmc< zE}0ZWo)V0I{iA6`EK>F%(mVy7yDWDg@g1e_0BWWq2o;!0edxg;jxqCvcxN*Ar7`#b zBV)87*W?L0+W%sB;9mko9gugU^3p)@H8aXP(5Y_G2p@}Q0k016!(Cw4VRV`(GB0I* zK~x~o86hfG0`Bqy5w9;cxLlc4j@ncore5|v|%T|XKdITmmBXqeorCOqL^?> pwAtPy#Onq887jAxH#XPpWWr{WxQ9jg3E_9L6==oU{L^o>{sLIdHfgc5S=SX{D&3dkV*(~-~yb|HkB&Uq#~&}R8^J6PKj{iD0UhU;;&QQoAF|= z(r^G~kHDSdWe zY=&o!xNsD*)Et8p4Avvy*=*vIyo_LhYFNlEMuWoo$G_NjBOZaL7@W?5ZH_l;XQOBh zGqLPKpJ5%@N>np9>S0w+R8o^S5!B%jwQc=1TcSFs+PuJG3SYuw>M+J{j>vd6&oQPS zM3Pr5)iwP%Ta4N+OI_qmX=j(-x8u_TvaHAyi;;ts>fgQ`Z;BXwVfHyZlOiAI__cUi zwxk+muCn~!Al}^9F23aU4!qwNr%*S$Pq0W)8D5)V6sUxKydA<)s(!FCIn7XS{RC&4 zheOOAW0b*rt7K25d{gfN7|880s>KL3!+}Xw+#L3%crs_g>f_`Bs);lvR8R-=7g`T3 zx9AI%Gl5p8h=FHkhI6YK7glg)sE=t=^=?))bL~{4^a@y4&|O?qG4BnPV5;$+hW^pJ zi|=ZDkDemnN{bTJSI|OUG1Q|3F`bDzia%nwyfdNQlCzlp(@#pj2){_8;r?s zsnP^HZ?!UXfq~tTUDUGT9ySu?h*4#HV(no)ys_S_5I5>A(TdZ-7yr&WYdd*b|0TH7A5v)%P_AX|DEfs zmidlTveX{?d4Zx0@+o-DRM%8~*pYnSrdI79VBE0(&Qz1!<9!XYl37&VA)D@UjIU{p zImGy_@MOQWyA4tKyT`tJ-*z87s`$jN?YX7?*tss{s#SfU{Wk4^^ttB=a_*M)%AU5n`a3(q>VAv%vmL6r(qvW{|7Fo`NTsSB_K<+T;QiLe`df~}IJXNh-!iE|^Qgt)B2 zY>8uX61xVa9854H!)9&WC21{iBazJEssy8oB*sN~lte^tTr=*$>f$DFU$n_ozzp0> z8OgdwpvEI<_F$zg5DF69PWh_w{F~U2gw)@6F64Akd#5>9u?Y7>7t)>ArhnJRXw{LP z_~>|3S(@Cs|1f*wOhAY61uYh>oF*GX6+?=eRT|o6>%&F)NnO2a{zkSh5V3RhMEwy@ zFBQK|<2Yk;z2?S9GLt)7zU-r)>Ym5f2FSs>S;K^&#V^drnRP$V-NPk7b3asRBW3{) zq{4#G*cv6sI%)XFGYnCOR8iP8PnvS1w)Rw?`1;nD@O~Fh2QY&gWoUjqGX)Q+C^S8NB{r; literal 3574 zcmd6qQBM<55QXR2#Q(7I2@^w%8WZ)Y0!AWGV^JQ^kV;$F*luy#3YGBJ)$`ryrCZuk zwqP`*%l6)xxo2k1%$@%JwQuXzw4NPWZmFGEU(c>(wqg%#*N(N9*qQBVHM53xP9^(Z zvR!GQ*VBF;-nur>8>@-zAn`+5jj)$kU8^0vAIfH3wo++!wAPm#JFM01sGuF~bIPjF zJe1r^eJa5YXqx&w()VrKupRl~|97>P*p^joO?z9~!%7S#9E46J4A_i5z!b!q{gw2(Mz;;rq7`)_NDQ4r0sFLzg35yI|ySm_qtRnTk75{z9D7QCRFz(hKPR|z~X%8@}d zuF9|4XKB*UigwRKTw20O7542ynn{qXOxTU9^Lo>CrEKW5o~&}-&7!t@S=F%*cy>=^ zBNaBUf3JMF3!@u)=6Vths{SNABe$E{jh(j)SE>1;^=iTPtPZf4z2n|i#wQrd?E+uC zTJOrEjZ4dS;}2P;52v~b$5~NL1CsP)ohAMi*^MCUz?H zT0v)Chq}IwK59+?&vVTmep@=4?E;pXko?s5+j~o|g9ZPS&pQDVocx=fGjB4>40I0n z;J?rHrwK&2&vz!@I$|q5knYa3UZ2-(mK0tgVe$`_!Ju!du0Zn}t)> zbh1}iIkuvc+IQ*F4gI%)&n--~MW1HR0oPaAB;Lv2D4RlF4(qH)(<@>R_xU>JAmTle sAM|>9ivI>0&*8{$hx>d>1enRW%Y2?`hfGaQD9d|%HAfdC|M^w&2SZe9TmS$7 diff --git a/DSCResources/ResourceSetHelper.psm1 b/DSCResources/ResourceSetHelper.psm1 index 7e1e51f22..675f38b9e 100644 --- a/DSCResources/ResourceSetHelper.psm1 +++ b/DSCResources/ResourceSetHelper.psm1 @@ -1,4 +1,4 @@ -# This module should not write any verbose or error messages unless a localization file for it is added +# This module should not write any verbose or error messages unless a localization file for it is added $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' @@ -44,7 +44,7 @@ function New-ResourceSetCommonParameterString $stringBuilder = New-Object -TypeName 'System.Text.StringBuilder' - foreach ($parameterName in $Parameters.Keys) + foreach ($parameterName in $Parameters.Keys) { # All composite resources have an extra parameter 'InstanceName' if ($parameterName -ine $KeyParameterName -and $parameterName -ine 'InstanceName') @@ -106,7 +106,7 @@ function New-ResourceSetCommonParameterString Name = "Telnet-Client" Ensure = "Present" IncludeAllSubFeature = $true - } + } xWindowsFeature Resource1 { @@ -139,8 +139,8 @@ function New-ResourceSetConfigurationString [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String[]] - $KeyParameterValues, - + $KeyParameterValues, + [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] @@ -162,7 +162,7 @@ function New-ResourceSetConfigurationString $null = $stringBuilder.AppendLine() $null = $stringBuilder.Append($CommonParameterString) $null = $stringBuilder.AppendLine('}') - + $resourceCount++ } @@ -195,7 +195,7 @@ function New-ResourceSetConfigurationString CommonParameterNames = @( 'Ensure', 'MembersToInclude', 'MembersToExclude', 'Credential' ) Parameters = $PSBoundParameters } - + $configurationScriptBlock = New-ResourceSetConfigurationScriptBlock @newResourceSetConfigurationParams .NOTES diff --git a/DSCResources/xGroupSet/xGroupSet.psd1 b/DSCResources/xGroupSet/xGroupSet.psd1 index f206dedf0..74bfba1ab 100644 --- a/DSCResources/xGroupSet/xGroupSet.psd1 +++ b/DSCResources/xGroupSet/xGroupSet.psd1 @@ -1,4 +1,4 @@ -@{ +@{ # Script module or binary module file associated with this manifest. RootModule = 'xGroupSet.schema.psm1' diff --git a/DSCResources/xGroupSet/xGroupSet.schema.psm1 b/DSCResources/xGroupSet/xGroupSet.schema.psm1 index a5d15433c..a466f685b 100644 --- a/DSCResources/xGroupSet/xGroupSet.schema.psm1 +++ b/DSCResources/xGroupSet/xGroupSet.schema.psm1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import ResourceSetHelper for New-ResourceSetConfigurationScriptBlock @@ -15,7 +15,7 @@ Import-Module -Name $script:resourceSetHelperFilePath .PARAMETER Ensure Specifies whether or not the set of groups should exist. - + Set this property to Present to create or modify a set of groups. Set this property to Absent to remove a set of groups. diff --git a/DSCResources/xProcessSet/xProcessSet.psd1 b/DSCResources/xProcessSet/xProcessSet.psd1 index 222858a1d..aa1ca381b 100644 --- a/DSCResources/xProcessSet/xProcessSet.psd1 +++ b/DSCResources/xProcessSet/xProcessSet.psd1 @@ -1,4 +1,4 @@ -@{ +@{ # Script module or binary module file associated with this manifest. RootModule = 'xProcessSet.schema.psm1' diff --git a/DSCResources/xProcessSet/xProcessSet.schema.psm1 b/DSCResources/xProcessSet/xProcessSet.schema.psm1 index 803ceef9f..ce17ad959 100644 --- a/DSCResources/xProcessSet/xProcessSet.schema.psm1 +++ b/DSCResources/xProcessSet/xProcessSet.schema.psm1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import ResourceSetHelper for New-ResourceSetConfigurationScriptBlock @@ -78,7 +78,7 @@ Configuration xProcessSet [String] $WorkingDirectory ) - + $newResourceSetConfigurationParams = @{ ResourceName = 'xWindowsProcess' ModuleName = 'xPSDesiredStateConfiguration' @@ -88,7 +88,7 @@ Configuration xProcessSet # Arguments is a key parameter in xWindowsProcess resource. Adding it as a common parameter with an empty value string $newResourceSetConfigurationParams['Parameters']['Arguments'] = '' - + $configurationScriptBlock = New-ResourceSetConfigurationScriptBlock @newResourceSetConfigurationParams # This script block must be run directly in this configuration in order to resolve variables diff --git a/DSCResources/xServiceSet/xServiceSet.psd1 b/DSCResources/xServiceSet/xServiceSet.psd1 index d848273f6..1746d6ddc 100644 --- a/DSCResources/xServiceSet/xServiceSet.psd1 +++ b/DSCResources/xServiceSet/xServiceSet.psd1 @@ -1,4 +1,4 @@ -@{ +@{ # Script module or binary module file associated with this manifest. RootModule = 'xServiceSet.schema.psm1' diff --git a/DSCResources/xServiceSet/xServiceSet.schema.psm1 b/DSCResources/xServiceSet/xServiceSet.schema.psm1 index b3f2bec68..4a34d24e6 100644 --- a/DSCResources/xServiceSet/xServiceSet.schema.psm1 +++ b/DSCResources/xServiceSet/xServiceSet.schema.psm1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import ResourceSetHelper for New-ResourceSetConfigurationScriptBlock @@ -15,7 +15,7 @@ Import-Module -Name $script:resourceSetHelperFilePath .PARAMETER Ensure Specifies whether or not the set of services should exist. - + Set this property to Present to modify a set of services. Set this property to Absent to remove a set of services. @@ -81,7 +81,7 @@ Configuration xServiceSet KeyParameterName = 'Name' Parameters = $PSBoundParameters } - + $configurationScriptBlock = New-ResourceSetConfigurationScriptBlock @newResourceSetConfigurationParams # This script block must be run directly in this configuration in order to resolve variables diff --git a/DSCResources/xWindowsFeatureSet/xWindowsFeatureSet.psd1 b/DSCResources/xWindowsFeatureSet/xWindowsFeatureSet.psd1 index 6849d9943..d54d2fe06 100644 --- a/DSCResources/xWindowsFeatureSet/xWindowsFeatureSet.psd1 +++ b/DSCResources/xWindowsFeatureSet/xWindowsFeatureSet.psd1 @@ -1,4 +1,4 @@ -@{ +@{ # Script module or binary module file associated with this manifest. RootModule = 'xWindowsFeatureSet.schema.psm1' diff --git a/DSCResources/xWindowsFeatureSet/xWindowsFeatureSet.schema.psm1 b/DSCResources/xWindowsFeatureSet/xWindowsFeatureSet.schema.psm1 index 017b3a661..d3f8a5203 100644 --- a/DSCResources/xWindowsFeatureSet/xWindowsFeatureSet.schema.psm1 +++ b/DSCResources/xWindowsFeatureSet/xWindowsFeatureSet.schema.psm1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import ResourceSetHelper for New-ResourceSetConfigurationScriptBlock @@ -70,7 +70,7 @@ Configuration xWindowsFeatureSet KeyParameterName = 'Name' Parameters = $PSBoundParameters } - + $configurationScriptBlock = New-ResourceSetConfigurationScriptBlock @newResourceSetConfigurationParams # This script block must be run directly in this configuration in order to resolve variables diff --git a/DSCResources/xWindowsOptionalFeatureSet/xWindowsOptionalFeatureSet.psd1 b/DSCResources/xWindowsOptionalFeatureSet/xWindowsOptionalFeatureSet.psd1 index 4a4942fc6..0b1627cb8 100644 --- a/DSCResources/xWindowsOptionalFeatureSet/xWindowsOptionalFeatureSet.psd1 +++ b/DSCResources/xWindowsOptionalFeatureSet/xWindowsOptionalFeatureSet.psd1 @@ -1,4 +1,4 @@ -@{ +@{ # Script module or binary module file associated with this manifest. RootModule = 'xWindowsOptionalFeatureSet.schema.psm1' diff --git a/DSCResources/xWindowsOptionalFeatureSet/xWindowsOptionalFeatureSet.schema.psm1 b/DSCResources/xWindowsOptionalFeatureSet/xWindowsOptionalFeatureSet.schema.psm1 index 6e1b65d6e..18f0ac18e 100644 --- a/DSCResources/xWindowsOptionalFeatureSet/xWindowsOptionalFeatureSet.schema.psm1 +++ b/DSCResources/xWindowsOptionalFeatureSet/xWindowsOptionalFeatureSet.schema.psm1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import ResourceSetHelper for New-ResourceSetConfigurationScriptBlock @@ -69,7 +69,7 @@ Configuration xWindowsOptionalFeatureSet KeyParameterName = 'Name' Parameters = $PSBoundParameters } - + $configurationScriptBlock = New-ResourceSetConfigurationScriptBlock @newResourceSetConfigurationParams # This script block must be run directly in this configuration in order to resolve variables diff --git a/Examples/Sample_xArchive_ExpandArchiveNoValidationCredential.ps1 b/Examples/Sample_xArchive_ExpandArchiveNoValidationCredential.ps1 index eea4e3cd7..711947338 100644 --- a/Examples/Sample_xArchive_ExpandArchiveNoValidationCredential.ps1 +++ b/Examples/Sample_xArchive_ExpandArchiveNoValidationCredential.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Expands the archive located at 'C:\ExampleArchivePath\Archive.zip' to the destination path 'C:\ExampleDestinationPath\Destination'. @@ -6,7 +6,7 @@ The added specification of a Credential here allows you to provide the credential of a user to provide the resource access to the archive and destination paths. - The resource will only check if the expanded archive files exist at the destination. + The resource will only check if the expanded archive files exist at the destination. No validation is performed on any existing files at the destination to ensure that they match the files in the archive. #> diff --git a/Examples/Sample_xArchive_RemoveArchiveChecksum.ps1 b/Examples/Sample_xArchive_RemoveArchiveChecksum.ps1 index a4fe7b65e..591911d75 100644 --- a/Examples/Sample_xArchive_RemoveArchiveChecksum.ps1 +++ b/Examples/Sample_xArchive_RemoveArchiveChecksum.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Remove the expansion of the archive located at 'C:\ExampleArchivePath\Archive.zip' from the destination path 'C:\ExampleDestinationPath\Destination'. diff --git a/Examples/Sample_xArchive_RemoveArchiveNoValidation.ps1 b/Examples/Sample_xArchive_RemoveArchiveNoValidation.ps1 index 51d218971..23922eb75 100644 --- a/Examples/Sample_xArchive_RemoveArchiveNoValidation.ps1 +++ b/Examples/Sample_xArchive_RemoveArchiveNoValidation.ps1 @@ -1,11 +1,11 @@ -<# +<# .SYNOPSIS Removes the expansion of the archive located at 'C:\ExampleArchivePath\Archive.zip' from the destination path 'C:\ExampleDestinationPath\Destination'. - The resource will only check if the expanded archive files exist at the destination. + The resource will only check if the expanded archive files exist at the destination. No validation is performed on any existing files at the destination to ensure that they - match the files in the archive before removing them. + match the files in the archive before removing them. #> Configuration Sample_xArchive_RemoveArchiveNoValidation { diff --git a/Examples/Sample_xDscWebServiceRegistration_UseSQLProvider.ps1 b/Examples/Sample_xDscWebServiceRegistration_UseSQLProvider.ps1 index 8dd953806..a22fd86ab 100644 --- a/Examples/Sample_xDscWebServiceRegistration_UseSQLProvider.ps1 +++ b/Examples/Sample_xDscWebServiceRegistration_UseSQLProvider.ps1 @@ -1,4 +1,4 @@ -# DSC configuration for Pull Server using registration with enhanced security settings +# DSC configuration for Pull Server using registration with enhanced security settings @@ -16,7 +16,7 @@ # Registration only works over https protocols. So to use registration feature, a secure pull server setup with certificate is necessary -# 2- Install and Configure SQL Server +# 2- Install and Configure SQL Server # The Sample_MetaConfigurationToRegisterWithSecurePullServer register a DSC client node with the pull server @@ -39,7 +39,7 @@ configuration Sample_xDscWebServiceRegistration_UseSQLProvider { - param + param ( @@ -61,10 +61,10 @@ configuration Sample_xDscWebServiceRegistration_UseSQLProvider ) - + Import-DSCResource -ModuleName xPSDesiredStateConfiguration - + Node $NodeName { @@ -75,7 +75,7 @@ configuration Sample_xDscWebServiceRegistration_UseSQLProvider Ensure = "Present" - Name = "DSC-Service" + Name = "DSC-Service" } @@ -93,23 +93,23 @@ configuration Sample_xDscWebServiceRegistration_UseSQLProvider PhysicalPath = "$env:SystemDrive\inetpub\PSDSCPullServer" - CertificateThumbPrint = $certificateThumbPrint + CertificateThumbPrint = $certificateThumbPrint ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules" - ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration" + ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration" State = "Started" - DependsOn = "[WindowsFeature]DSCServiceFeature" + DependsOn = "[WindowsFeature]DSCServiceFeature" - RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService" + RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService" AcceptSelfSignedCertificates = $true UseSecurityBestPractices = $true - SqlProvider = $true + SqlProvider = $true SqlConnectionString = "Provider=SQLNCLI11;Data Source=(local)\SQLExpress;User ID=SA;Password=Password12!;Initial Catalog=master;" @@ -197,7 +197,7 @@ configuration Sample_MetaConfigurationToRegisterWithSecurePullServer ConfigurationNames = @('ClientConfig') - } + } diff --git a/Examples/Sample_xDscWebServiceRegistration_Win2k12and2k12R2.ps1 b/Examples/Sample_xDscWebServiceRegistration_Win2k12and2k12R2.ps1 index 735ba3ef1..a129793a5 100644 --- a/Examples/Sample_xDscWebServiceRegistration_Win2k12and2k12R2.ps1 +++ b/Examples/Sample_xDscWebServiceRegistration_Win2k12and2k12R2.ps1 @@ -1,4 +1,4 @@ -# DSC configuration for Pull Server using registration with enhanced security settings +# DSC configuration for Pull Server using registration with enhanced security settings @@ -16,7 +16,7 @@ # Registration only works over https protocols. So to use registration feature, a secure pull server setup with certificate is necessary -# 2- Install and Configure SQL Server +# 2- Install and Configure SQL Server # The Sample_MetaConfigurationToRegisterWithSecurePullServer register a DSC client node with the pull server @@ -39,7 +39,7 @@ configuration Sample_xDscWebServiceRegistration_UseSQLProvider { - param + param ( @@ -61,10 +61,10 @@ configuration Sample_xDscWebServiceRegistration_UseSQLProvider ) - + Import-DSCResource -ModuleName xPSDesiredStateConfiguration - + Node $NodeName { @@ -75,7 +75,7 @@ configuration Sample_xDscWebServiceRegistration_UseSQLProvider Ensure = "Present" - Name = "DSC-Service" + Name = "DSC-Service" } @@ -93,24 +93,24 @@ configuration Sample_xDscWebServiceRegistration_UseSQLProvider PhysicalPath = "$env:SystemDrive\inetpub\PSDSCPullServer" - CertificateThumbPrint = $certificateThumbPrint + CertificateThumbPrint = $certificateThumbPrint ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules" - ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration" + ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration" State = "Started" - DependsOn = "[WindowsFeature]DSCServiceFeature" + DependsOn = "[WindowsFeature]DSCServiceFeature" - RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService" + RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService" AcceptSelfSignedCertificates = $true UseSecurityBestPractices = $true Enable32BitAppOnWin64 = $true - + } @@ -166,7 +166,7 @@ configuration Sample_MetaConfigurationToRegisterWithSecurePullServer ServerURL = "https://$ServerName`:8080/PSDSCPullServer.svc" # notice it is https RegistrationKey = $RegistrationKey ConfigurationNames = @('ClientConfig') - } + } ReportServerWeb CONTOSO-PullSrv { diff --git a/Examples/Sample_xEnvironment_CreateMultiplePathVariables.ps1 b/Examples/Sample_xEnvironment_CreateMultiplePathVariables.ps1 index c13b22493..6f37c732f 100644 --- a/Examples/Sample_xEnvironment_CreateMultiplePathVariables.ps1 +++ b/Examples/Sample_xEnvironment_CreateMultiplePathVariables.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Ensures that the 'TestPathEnvironmentVariable' environment variable exists and that its value includes both "C:\test123" and "C:\test456". If one or both of these values do not exist @@ -6,7 +6,7 @@ In this example changes are made to both the machine and the process. #> -Configuration Sample_xEnvironment_CreateMultiplePathVariables +Configuration Sample_xEnvironment_CreateMultiplePathVariables { param () diff --git a/Examples/Sample_xEnvironment_CreateNonPathVariable.ps1 b/Examples/Sample_xEnvironment_CreateNonPathVariable.ps1 index 150e037b9..45e58cd2a 100644 --- a/Examples/Sample_xEnvironment_CreateNonPathVariable.ps1 +++ b/Examples/Sample_xEnvironment_CreateNonPathVariable.ps1 @@ -1,9 +1,9 @@ -<# +<# .SYNOPSIS Creates the environment variable 'TestEnvironmentVariable' and sets the value to 'TestValue' both on the machine and within the process. #> -Configuration Sample_xEnvironment_CreateNonPathVariable +Configuration Sample_xEnvironment_CreateNonPathVariable { param () diff --git a/Examples/Sample_xEnvironment_CreatePathVariable.ps1 b/Examples/Sample_xEnvironment_CreatePathVariable.ps1 index 386337182..ed46c8fe7 100644 --- a/Examples/Sample_xEnvironment_CreatePathVariable.ps1 +++ b/Examples/Sample_xEnvironment_CreatePathVariable.ps1 @@ -1,10 +1,10 @@ -<# +<# .SYNOPSIS Creates the environment variable 'TestPathEnvironmentVariable' and sets the value to 'TestValue' if it doesn't already exist or appends the value 'TestValue' to the existing path if it does already exist on the machine and within the process. #> -Configuration Sample_xEnvironment_CreatePathVariable +Configuration Sample_xEnvironment_CreatePathVariable { param () diff --git a/Examples/Sample_xEnvironment_Remove.ps1 b/Examples/Sample_xEnvironment_Remove.ps1 index d9d79265d..7ced04d78 100644 --- a/Examples/Sample_xEnvironment_Remove.ps1 +++ b/Examples/Sample_xEnvironment_Remove.ps1 @@ -1,9 +1,9 @@ -<# +<# .SYNOPSIS Removes the environment variable 'TestEnvironmentVariable' from both the machine and the process. #> -Configuration Sample_xEnvironment_Remove +Configuration Sample_xEnvironment_Remove { param () diff --git a/Examples/Sample_xEnvironment_RemovePathVariables.ps1 b/Examples/Sample_xEnvironment_RemovePathVariables.ps1 index 176eb7f55..bbb669431 100644 --- a/Examples/Sample_xEnvironment_RemovePathVariables.ps1 +++ b/Examples/Sample_xEnvironment_RemovePathVariables.ps1 @@ -1,11 +1,11 @@ -<# +<# .SYNOPSIS Removes one or more values from the 'TestPathEnvironmentVariable' environment variable if the values exist. Other values of the 'TestPathEnvironmentVariable' environment variable will not be modified. In this example, the values 'C:\test456' and 'C:\test123' will be removed, but all other entries will be left intact. In this example changes are made to applied the machine and the process. #> -Configuration Sample_xEnvironment_Path_Remove +Configuration Sample_xEnvironment_Path_Remove { param () diff --git a/Examples/Sample_xGroupSet_AddMembers.ps1 b/Examples/Sample_xGroupSet_AddMembers.ps1 index 75839d644..abfb06f81 100644 --- a/Examples/Sample_xGroupSet_AddMembers.ps1 +++ b/Examples/Sample_xGroupSet_AddMembers.ps1 @@ -1,9 +1,9 @@ -<# +<# .SYNOPSIS If the groups named GroupName1 and Administrators do not exist, creates the groups named GroupName1 and Administrators and adds the users with the usernames Username1 and Username2 to both groups. - + If the groups named GroupName1 and Administrators already exist, adds the users with the usernames Username1 and Username2 to both groups. #> diff --git a/Examples/Sample_xGroup_RemoveMembers.ps1 b/Examples/Sample_xGroup_RemoveMembers.ps1 index 5aefbea87..18950cd7e 100644 --- a/Examples/Sample_xGroup_RemoveMembers.ps1 +++ b/Examples/Sample_xGroup_RemoveMembers.ps1 @@ -1,7 +1,7 @@ -<# +<# .SYNOPSIS If the group named GroupName1 does not exist, creates a group named GroupName1. - + If the group named GroupName1 already exists removes the users that have the usernames Username1 or Username2 from the group. #> diff --git a/Examples/Sample_xGroup_SetMembers.ps1 b/Examples/Sample_xGroup_SetMembers.ps1 index 6b99cf3a5..e0a9f6056 100644 --- a/Examples/Sample_xGroup_SetMembers.ps1 +++ b/Examples/Sample_xGroup_SetMembers.ps1 @@ -1,8 +1,8 @@ -<# +<# .SYNOPSIS If the group named GroupName1 does not exist, creates a group named GroupName1 and adds the users with the usernames Username1 and Username2 to the group. - + If the group named GroupName1 already exists, removes any users that do not have the usernames Username1 or Username2 from the group and adds the users that have the usernames Username1 and Username2 to the group. diff --git a/Examples/Sample_xProcessSet_Start.ps1 b/Examples/Sample_xProcessSet_Start.ps1 index c8001557c..e5d020f47 100644 --- a/Examples/Sample_xProcessSet_Start.ps1 +++ b/Examples/Sample_xProcessSet_Start.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Starts the processes with the executables at the file paths C:\Windows\cmd.exe and C:\TestPath\TestProcess.exe with no arguments. diff --git a/Examples/Sample_xProcessSet_Stop.ps1 b/Examples/Sample_xProcessSet_Stop.ps1 index 0e67f26a8..afb1a58c5 100644 --- a/Examples/Sample_xProcessSet_Stop.ps1 +++ b/Examples/Sample_xProcessSet_Stop.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Stops the processes with the executables at the file paths C:\Windows\cmd.exe and C:\TestPath\TestProcess.exe with no arguments and logs any output to the path diff --git a/Examples/Sample_xRegistryResource_AddKey.ps1 b/Examples/Sample_xRegistryResource_AddKey.ps1 index ea0aaf749..aa8d58bd3 100644 --- a/Examples/Sample_xRegistryResource_AddKey.ps1 +++ b/Examples/Sample_xRegistryResource_AddKey.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Create a new registry key called MyNewKey as a subkey under the key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'. diff --git a/Examples/Sample_xRegistryResource_AddOrModifyValue.ps1 b/Examples/Sample_xRegistryResource_AddOrModifyValue.ps1 index 136874a7b..ca71d8a7a 100644 --- a/Examples/Sample_xRegistryResource_AddOrModifyValue.ps1 +++ b/Examples/Sample_xRegistryResource_AddOrModifyValue.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS If the registry key value MyValue under the key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' does not exist, diff --git a/Examples/Sample_xRegistryResource_RemoveKey.ps1 b/Examples/Sample_xRegistryResource_RemoveKey.ps1 index e96d44575..1eda9e80e 100644 --- a/Examples/Sample_xRegistryResource_RemoveKey.ps1 +++ b/Examples/Sample_xRegistryResource_RemoveKey.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Removes the registry key called MyNewKey under the parent key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'. diff --git a/Examples/Sample_xRegistryResource_RemoveValue.ps1 b/Examples/Sample_xRegistryResource_RemoveValue.ps1 index 96107ce5b..9d147be4f 100644 --- a/Examples/Sample_xRegistryResource_RemoveValue.ps1 +++ b/Examples/Sample_xRegistryResource_RemoveValue.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Removes the registry key value MyValue from the key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'. diff --git a/Examples/Sample_xScript.ps1 b/Examples/Sample_xScript.ps1 index e0f04c76d..776883028 100644 --- a/Examples/Sample_xScript.ps1 +++ b/Examples/Sample_xScript.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Creates a file at the given file path with the specified content through the xScript resource. diff --git a/Examples/Sample_xServiceSet_BuiltInAccount.ps1 b/Examples/Sample_xServiceSet_BuiltInAccount.ps1 index 9effb23b2..1c9d57b8d 100644 --- a/Examples/Sample_xServiceSet_BuiltInAccount.ps1 +++ b/Examples/Sample_xServiceSet_BuiltInAccount.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Sets the Secure Socket Tunneling Protocol and DHCP Client services to run under the built-in account LocalService. diff --git a/Examples/Sample_xServiceSet_StartServices.ps1 b/Examples/Sample_xServiceSet_StartServices.ps1 index f5b524f35..42a879040 100644 --- a/Examples/Sample_xServiceSet_StartServices.ps1 +++ b/Examples/Sample_xServiceSet_StartServices.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Ensures that the DHCP Client and Windows Firewall services are running. #> diff --git a/Examples/Sample_xUser_CreateUser.ps1 b/Examples/Sample_xUser_CreateUser.ps1 index 8f66dc8c0..a278730fe 100644 --- a/Examples/Sample_xUser_CreateUser.ps1 +++ b/Examples/Sample_xUser_CreateUser.ps1 @@ -1,4 +1,4 @@ -Configuration xUserExample +Configuration xUserExample { param ( [System.Management.Automation.PSCredential] diff --git a/Examples/Sample_xUser_Generic.ps1 b/Examples/Sample_xUser_Generic.ps1 index d9fa1ae72..e0f889132 100644 --- a/Examples/Sample_xUser_Generic.ps1 +++ b/Examples/Sample_xUser_Generic.ps1 @@ -1,10 +1,10 @@ -param +param ( [Parameter(Mandatory)] [System.String] $ConfigurationName ) - + <# Create a custom configuration by passing in whatever values you need. $Password is the only param that is @@ -16,25 +16,25 @@ Configuration $ConfigurationName { - param - ( + param + ( [System.String] $UserName = 'Test UserName', - + [System.String] $Description = 'Test Description', - + [System.String] $FullName = 'Test Full Name', - + [ValidateSet('Present', 'Absent')] [System.String] $Ensure = 'Present', - + [Parameter(Mandatory)] [System.Management.Automation.PSCredential] $Password, - + [System.Boolean] $Disabled = $false, @@ -47,9 +47,9 @@ Configuration $ConfigurationName [System.Boolean] $PasswordChangeNotAllowed = $false ) - + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - + Node Localhost { xUser UserResource1 diff --git a/Examples/Sample_xWindowsFeature.ps1 b/Examples/Sample_xWindowsFeature.ps1 index c152f4883..e1e337f80 100644 --- a/Examples/Sample_xWindowsFeature.ps1 +++ b/Examples/Sample_xWindowsFeature.ps1 @@ -1,16 +1,16 @@ -<# - Create a custom configuration by passing in whatever values you need. +<# + Create a custom configuration by passing in whatever values you need. $Name is the only parameter that is required which indicates which Windows Feature you want to install (or uninstall if you set Ensure to Absent). LogPath and Credential are not included here, but if you would like to specify a custom log path or need a credential just pass in the desired values and add LogPath = $LogPath and/or Credential = $Credential to the configuration here -#> +#> Configuration 'Install_Feature_Telnet_Client' { - param - ( + param + ( [System.String] $Name = 'Telnet-Client', @@ -29,9 +29,9 @@ Configuration 'Install_Feature_Telnet_Client' [System.String] $LogPath ) - + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - + Node Localhost { xWindowsFeature WindowsFeatureTest diff --git a/Examples/Sample_xWindowsFeatureSet_Install.ps1 b/Examples/Sample_xWindowsFeatureSet_Install.ps1 index 7703b6224..0af76c1e2 100644 --- a/Examples/Sample_xWindowsFeatureSet_Install.ps1 +++ b/Examples/Sample_xWindowsFeatureSet_Install.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Installs the TelnetClient and RSAT-File-Services Windows features, including all their subfeatures. Logs the operation to the file at 'C:\LogPath\Log.log'. diff --git a/Examples/Sample_xWindowsFeatureSet_Uninstall.ps1 b/Examples/Sample_xWindowsFeatureSet_Uninstall.ps1 index 9b3ea3eb5..996d0829d 100644 --- a/Examples/Sample_xWindowsFeatureSet_Uninstall.ps1 +++ b/Examples/Sample_xWindowsFeatureSet_Uninstall.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Uninstalls the TelnetClient and RSAT-File-Services Windows features, including all their subfeatures. Logs the operation to the file at 'C:\LogPath\Log.log'. diff --git a/Examples/Sample_xWindowsOptionalFeature.ps1 b/Examples/Sample_xWindowsOptionalFeature.ps1 index 220160eea..23d95e95b 100644 --- a/Examples/Sample_xWindowsOptionalFeature.ps1 +++ b/Examples/Sample_xWindowsOptionalFeature.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Enables the Windows optional feature with the specified name and outputs a log to the specified path. diff --git a/Examples/Sample_xWindowsOptionalFeatureSet_Disable.ps1 b/Examples/Sample_xWindowsOptionalFeatureSet_Disable.ps1 index 777c5684f..dd66aa244 100644 --- a/Examples/Sample_xWindowsOptionalFeatureSet_Disable.ps1 +++ b/Examples/Sample_xWindowsOptionalFeatureSet_Disable.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Disables the Windows optional features TelnetClient and LegacyComponents and removes all files associated with these features. diff --git a/Examples/Sample_xWindowsOptionalFeatureSet_Enable.ps1 b/Examples/Sample_xWindowsOptionalFeatureSet_Enable.ps1 index 1bb96b865..45cba7f77 100644 --- a/Examples/Sample_xWindowsOptionalFeatureSet_Enable.ps1 +++ b/Examples/Sample_xWindowsOptionalFeatureSet_Enable.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Enables the Windows optional features MicrosoftWindowsPowerShellV2 and Internet-Explorer-Optional-amd64 and outputs a log of the operations to a file at the path diff --git a/Examples/Sample_xWindowsPackageCab.ps1 b/Examples/Sample_xWindowsPackageCab.ps1 index 5f7469860..25a0cdb26 100644 --- a/Examples/Sample_xWindowsPackageCab.ps1 +++ b/Examples/Sample_xWindowsPackageCab.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Installs a package from the cab file with the specified name from the specified source path and outputs a log to the specified log path. diff --git a/README.md b/README.md index f93d980c9..4d3136743 100644 --- a/README.md +++ b/README.md @@ -653,6 +653,9 @@ Publishes a 'FileInfo' object(s) to the pullserver configuration repository. It ### Unreleased +* Changes to xPSDesiredStateConfiguration + * Opt-in for the common tests validate module files and script files. + * All files change to encoding UTF-8 (without byte order mark). * xEnvironment path documentation update demonstrating usage with multiple values ([issue #415](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/415). [Alex Kokkinos (@alexkokkinos)](https://github.com/alexkokkinos) ### 8.3.0.0 diff --git a/Tests/CommonTestHelper.psm1 b/Tests/CommonTestHelper.psm1 index 823566097..7defa6e04 100644 --- a/Tests/CommonTestHelper.psm1 +++ b/Tests/CommonTestHelper.psm1 @@ -1,4 +1,4 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] param () $errorActionPreference = 'Stop' @@ -157,7 +157,7 @@ function Invoke-ExpectedMocksAreCalledTest Each item in the array is a hashtable that contains the name of the command being mocked, the number of times it is called (can be 0) and, optionally, an extra custom string to make the test name more descriptive. The custom - string will only work if the command has a corresponding variable in the + string will only work if the command has a corresponding variable in the string data name. .PARAMETER ShouldThrow @@ -227,7 +227,7 @@ function Invoke-GenericUnitTest { Each item in the array is a hashtable that contains the name of the command being mocked, the number of times it is called (can be 0) and, optionally, an extra custom string to make the test name more descriptive. The custom - string will only work if the command has a corresponding variable in the + string will only work if the command has a corresponding variable in the string data name. .PARAMETER ExpectedReturnValue @@ -288,7 +288,7 @@ function Invoke-GetTargetResourceUnitTest Each item in the array is a hashtable that contains the name of the command being mocked, the number of times it is called (can be 0) and, optionally, an extra custom string to make the test name more descriptive. The custom - string will only work if the command has a corresponding variable in the + string will only work if the command has a corresponding variable in the string data name. .PARAMETER ShouldThrow @@ -354,7 +354,7 @@ function Invoke-SetTargetResourceUnitTest { Each item in the array is a hashtable that contains the name of the command being mocked, the number of times it is called (can be 0) and, optionally, an extra custom string to make the test name more descriptive. The custom - string will only work if the command has a corresponding variable in the + string will only work if the command has a corresponding variable in the string data name. .PARAMETER ExpectedReturnValue @@ -574,7 +574,7 @@ function Test-IsFileLocked .PARAMETER ExpectedOutput The output expected to be in the output from running WhatIf with the Set-TargetResource cmdlet. If this parameter is empty or null, this cmdlet will check that there was no output from - Set-TargetResource with WhatIf specified. + Set-TargetResource with WhatIf specified. #> function Test-SetTargetResourceWithWhatIf { @@ -585,7 +585,7 @@ function Test-SetTargetResourceWithWhatIf [Parameter(Mandatory = $true)] [Hashtable] $Parameters, - + [String[]] $ExpectedOutput ) diff --git a/Tests/DSCTestService.cs b/Tests/DSCTestService.cs index 6903e892e..41fdf3ba6 100644 --- a/Tests/DSCTestService.cs +++ b/Tests/DSCTestService.cs @@ -1,4 +1,4 @@ -namespace TestServiceNamespace +namespace TestServiceNamespace { using System; using System.ComponentModel; diff --git a/Tests/DSCTestServiceNew.cs b/Tests/DSCTestServiceNew.cs index 6903e892e..41fdf3ba6 100644 --- a/Tests/DSCTestServiceNew.cs +++ b/Tests/DSCTestServiceNew.cs @@ -1,4 +1,4 @@ -namespace TestServiceNamespace +namespace TestServiceNamespace { using System; using System.ComponentModel; diff --git a/Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1 b/Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1 index 198cefd00..2bcfae91e 100644 --- a/Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1 +++ b/Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' Describe 'xArchive End to End Tests' { @@ -147,7 +147,7 @@ Describe 'xArchive End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathValidateOnly -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @archiveParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -229,7 +229,7 @@ Describe 'xArchive End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathValidateOnly -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @archiveParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -272,7 +272,7 @@ Describe 'xArchive End to End Tests' { MSFT_xArchive\Test-TargetResource @archiveParameters | Should Be $true } } - + Context 'Expand an archive to an existing destination that already contains the same archive files' { $configurationName = 'ExpandArchiveToDestinationWithArchive' @@ -300,7 +300,7 @@ Describe 'xArchive End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathValidateOnly -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @archiveParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -355,7 +355,7 @@ Describe 'xArchive End to End Tests' { It 'Should compile and run configuration and throw an error for attempting to overwrite files without Force specified' { # We don't know which file will throw the error, so we will only check that an error was thrown rather than checking the specific error message - { + { . $script:confgurationFilePathValidateAndChecksum -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @archiveParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -413,7 +413,7 @@ Describe 'xArchive End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathValidateAndChecksum -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @archiveParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -471,7 +471,7 @@ Describe 'xArchive End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathValidateAndChecksum -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @archiveParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -494,7 +494,7 @@ Describe 'xArchive End to End Tests' { MSFT_xArchive\Test-TargetResource @archiveParameters | Should Be $true } } - + Context 'Remove an expanded archive from an existing destination that contains only the expanded archive' { $configurationName = 'RemoveArchiveAtDestinationWithArchive' @@ -522,7 +522,7 @@ Describe 'xArchive End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathValidateOnly -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @archiveParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -610,7 +610,7 @@ Describe 'xArchive End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathValidateOnly -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @archiveParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -679,7 +679,7 @@ Describe 'xArchive End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathValidateOnly -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @archiveParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -719,7 +719,7 @@ Describe 'xArchive End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathValidateOnly -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @archiveParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -769,7 +769,7 @@ Describe 'xArchive End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathValidateAndChecksum -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @archiveParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -823,7 +823,7 @@ Describe 'xArchive End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathValidateAndChecksum -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @archiveParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force diff --git a/Tests/Integration/MSFT_xArchive.TestHelper.psm1 b/Tests/Integration/MSFT_xArchive.TestHelper.psm1 index 2b5f3ef5c..146952edd 100644 --- a/Tests/Integration/MSFT_xArchive.TestHelper.psm1 +++ b/Tests/Integration/MSFT_xArchive.TestHelper.psm1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' Add-Type -AssemblyName 'System.IO.Compression.FileSystem' @@ -66,7 +66,7 @@ function ConvertTo-FileStructure .SYNOPSIS Creates a new zip file with the specified name and file structure under the specified parent path. Returns the file path to the compressed zip file. - + .PARAMETER ParentPath The path under which the new zip file should be created. @@ -78,7 +78,7 @@ function ConvertTo-FileStructure Nested hashtable values denote directories with the key as the name of the directory and the hashtable value as the contents. String values denote files with the key as the name of the file and the value as the contents. - + .EXAMPLE $zipFileStructure = @{ DirectoryName = @{ diff --git a/Tests/Integration/MSFT_xArchive_CredentialOnly.config.ps1 b/Tests/Integration/MSFT_xArchive_CredentialOnly.config.ps1 index 89bc85d4c..34b606f34 100644 --- a/Tests/Integration/MSFT_xArchive_CredentialOnly.config.ps1 +++ b/Tests/Integration/MSFT_xArchive_CredentialOnly.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/MSFT_xArchive_ValidateAndChecksum.config.ps1 b/Tests/Integration/MSFT_xArchive_ValidateAndChecksum.config.ps1 index 8a1541917..1ed2814b7 100644 --- a/Tests/Integration/MSFT_xArchive_ValidateAndChecksum.config.ps1 +++ b/Tests/Integration/MSFT_xArchive_ValidateAndChecksum.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/MSFT_xArchive_ValidateOnly.config.ps1 b/Tests/Integration/MSFT_xArchive_ValidateOnly.config.ps1 index 18ecbe42d..998e5811d 100644 --- a/Tests/Integration/MSFT_xArchive_ValidateOnly.config.ps1 +++ b/Tests/Integration/MSFT_xArchive_ValidateOnly.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/MSFT_xEnvironmentResource.EndToEnd.Tests.ps1 b/Tests/Integration/MSFT_xEnvironmentResource.EndToEnd.Tests.ps1 index 1dc602168..77f585c08 100644 --- a/Tests/Integration/MSFT_xEnvironmentResource.EndToEnd.Tests.ps1 +++ b/Tests/Integration/MSFT_xEnvironmentResource.EndToEnd.Tests.ps1 @@ -1,4 +1,4 @@ -<# +<# Please note that some of these tests depend on each other. They must be run in the order given - if one test fails, subsequent tests may also fail. @@ -76,7 +76,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testEnvironmentVarName @@ -104,7 +104,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testEnvironmentVarName @@ -132,7 +132,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testEnvironmentVarName @@ -160,7 +160,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testEnvironmentVarName @@ -200,7 +200,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testPathEnvironmentVarName @@ -231,7 +231,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testPathEnvironmentVarName @@ -262,7 +262,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testPathEnvironmentVarName @@ -291,7 +291,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testPathEnvironmentVarName @@ -320,7 +320,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testPathEnvironmentVarName @@ -382,7 +382,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testEnvironmentVarName @@ -411,7 +411,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testEnvironmentVarName @@ -440,7 +440,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testEnvironmentVarName @@ -469,7 +469,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testEnvironmentVarName @@ -504,7 +504,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testPathEnvironmentVarName @@ -536,7 +536,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testPathEnvironmentVarName @@ -568,7 +568,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testPathEnvironmentVarName @@ -598,7 +598,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testPathEnvironmentVarName @@ -628,7 +628,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testPathEnvironmentVarName @@ -693,7 +693,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testEnvironmentVarName @@ -722,7 +722,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testEnvironmentVarName @@ -751,7 +751,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testEnvironmentVarName @@ -780,7 +780,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testEnvironmentVarName @@ -818,7 +818,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testPathEnvironmentVarName @@ -850,7 +850,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testPathEnvironmentVarName @@ -882,7 +882,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testPathEnvironmentVarName @@ -912,7 +912,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testPathEnvironmentVarName @@ -942,7 +942,7 @@ try It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $testPathEnvironmentVarName diff --git a/Tests/Integration/MSFT_xEnvironmentResource.Integration.Tests.ps1 b/Tests/Integration/MSFT_xEnvironmentResource.Integration.Tests.ps1 index b3a09088c..e3ec00477 100644 --- a/Tests/Integration/MSFT_xEnvironmentResource.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_xEnvironmentResource.Integration.Tests.ps1 @@ -1,4 +1,4 @@ -# These tests must be run with elevated access +# These tests must be run with elevated access $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' @@ -26,7 +26,7 @@ try } It 'Should return the correct value for an environment variable that exists' { - $envVar = 'Username' + $envVar = 'Username' $retrievedVar = Get-TargetResource -Name $envVar # Verify the environmnet variable $envVar is successfully retrieved @@ -44,11 +44,11 @@ try $envVar = 'BlahVar' Set-TargetResource -Name $envVar -Ensure Absent - + $retrievedVar = Get-TargetResource -Name $envVar # Verify the environmnet variable $envVar is not found - $retrievedVar.Ensure | Should Be 'Absent' + $retrievedVar.Ensure | Should Be 'Absent' } It 'Should throw an error when creating a new environment variable with no Value specified' { @@ -57,16 +57,16 @@ try Set-TargetResource -Name $envVar -Ensure Absent { Set-TargetResource -Name $envVar } | Should Throw - + # Now retrieve the created variable $retrievedVar = Get-TargetResource -Name $envVar # Verify the environmnet variable $envVar is successfully created - $retrievedVar.Ensure | Should Be 'Absent' + $retrievedVar.Ensure | Should Be 'Absent' # Verify the create environmnet variable's value is set to default value [String]::Empty $retrievedVar.Value | Should Be $null - + # Remove the created test variable Set-TargetResource -Name $envVar -Ensure Absent } @@ -79,16 +79,16 @@ try Set-TargetResource -Name $envVar -Ensure Absent Set-TargetResource -Name $envVar -Value $val - + # Now retrieve the created variable $retrievedVar = Get-TargetResource -Name $envVar # Verify the environmnet variable $envVar is successfully created - $retrievedVar.Ensure | Should Be 'Present' + $retrievedVar.Ensure | Should Be 'Present' # Verify the create environmnet variable's value is set $retrievedVar.Value | Should Be $val - + # Remove the created test variable Set-TargetResource -Name $envVar -Ensure Absent } @@ -99,17 +99,17 @@ try # Create the environment variable Set-TargetResource -Name $envVar -Value $val - + # Update the environment variable $newVal = 'TestEnvNewVal' Set-TargetResource -Name $envVar -Value $newVal - + # Now retrieve the created variable $retrievedVar = Get-TargetResource -Name $envVar # Verify the environmnet variable $envVar is successfully updated $retrievedVar.Value | Should Be $newVal - + # Remove the created test variable Set-TargetResource -Name $envVar -Ensure Absent } @@ -120,9 +120,9 @@ try # Create the environment variable Set-TargetResource -Name $envVar -Value $val - + Set-TargetResource -Name $envVar -Ensure Absent - + # Now try to retrieve the created variable $retrievedVar = Get-TargetResource -Name $envVar @@ -134,17 +134,17 @@ try $envVar = 'TestEnvVar' $val = 'A;B;C' Set-TargetResource -Name $envVar -Value $val -Path $true - - $addPathVal = 'D' + + $addPathVal = 'D' Set-TargetResource -Name $envVar -Value $addPathVal -Path $true - + $expectedFinalVal = $val + ';' + $addPathVal # Now try to retrieve the created variable $retrievedVar = Get-TargetResource -Name $envVar # Verify the environmnet variable no more exists $retrievedVar.Value | Should Be $expectedFinalVal - + # Remove the created test variable Set-TargetResource -Name $envVar -Ensure Absent } @@ -153,17 +153,17 @@ try $envVar = 'TestEnvVar' $val = 'A;B;C' Set-TargetResource -Name $envVar -Value $val -Path $true - - $removePathVal = 'C' + + $removePathVal = 'C' Set-TargetResource -Name $envVar -Value $removePathVal -Path $true -Ensure Absent - + $expectedFinalVal = 'A;B' # Now try to retrieve the created variable $retrievedVar = Get-TargetResource -Name $envVar # Verify the environmnet variable no more exists $retrievedVar.Value | Should Be $expectedFinalVal - + # Remove the created test variable Set-TargetResource -Name $envVar -Ensure Absent } @@ -172,16 +172,16 @@ try $envVar = 'TestEnvVar' $val = 'A;B;C' Set-TargetResource -Name $envVar -Value $val -Path $true - - $removePathVal = 'C;B;A' + + $removePathVal = 'C;B;A' Set-TargetResource -Name $envVar -Value $removePathVal -Path $true -Ensure Absent - + # Now try to retrieve the created variable $retrievedVar = Get-TargetResource -Name $envVar # Verify the environmnet variable no more exists $retrievedVar.Ensure | Should Be 'Absent' - + # Remove the created test variable Set-TargetResource -Name $envVar -Ensure Absent } @@ -189,82 +189,82 @@ try It 'Should return true when an environment variable is present and should be' { $envVar = 'BlahVar' $val = 'A;B;C' - + Set-TargetResource -Name $envVar -Value $val - + # Test the created environmnet variable Test-TargetResource -Name $envVar | Should Be $true - + # Remove the created test variable Set-TargetResource -Name $envVar -Ensure Absent } It 'Should return true when an environment environment with a specific value exists and should' { - $envVar = 'BlahVar' - $val = 'BlahVal' + $envVar = 'BlahVar' + $val = 'BlahVal' Set-TargetResource -Name $envVar -Value $val - + # Verify the environmnet variable exists Test-TargetResource -Name $envVar -Value $val | Should Be $true - + # Remove the created test variable Set-TargetResource -Name $envVar -Ensure Absent } It 'Should return true when an environment variable is absent and should be' { - $envVar = 'BlahVar' + $envVar = 'BlahVar' Set-TargetResource -Name $envVar -Ensure Absent - + # Verify the environmnet variable exists Test-TargetResource -Name $envVar -Ensure Absent | Should Be $true - + # Remove the created test variable Set-TargetResource -Name $envVar -Ensure Absent } It 'Should return true when a path exists in a path environment variable and should' { - $envVar = 'PathVar' - $val = 'A;B;C' + $envVar = 'PathVar' + $val = 'A;B;C' Set-TargetResource -Name $envVar -Value $val -Path $true - + $subpath = 'B' - + # Test a sub-path exists in environment variable Test-TargetResource -Name $envVar -Value $subpath -Path $true | Should Be $true - + # Remove the created test variable Set-TargetResource -Name $envVar -Ensure Absent } It 'Should return true when a matching but shuffled path exists in a path environment variable' { - $envVar = 'PathVar' - $val = 'A;B;C' + $envVar = 'PathVar' + $val = 'A;B;C' Set-TargetResource -Name $envVar -Value $val -Path $true - + $subpath = 'B;a;c' - + Test-TargetResource -Name $envVar -Value $subpath -Path $true | Should Be $true - + # Remove the created test variable Set-TargetResource -Name $envVar -Ensure Absent } It 'Should return true when a path does not exist in a path environment variable and should not' { - $envVar = 'PathVar' - $val = 'A;B;C' + $envVar = 'PathVar' + $val = 'A;B;C' Set-TargetResource -Name $envVar -Value $val -Path $true - + $subpath = 'D;E' - + Test-TargetResource -Name $envVar -Value $subpath -Path $true -Ensure Absent | Should Be $true - + # Remove the created test variable Set-TargetResource -Name $envVar -Ensure Absent } It 'Should retrieve an existing environment variable using Get-TargetResource' { $envVar = 'windir' - + $retrievedVar = Get-TargetResource -Name $envVar # Verify the environmnet variable $envVar is successfully retrieved diff --git a/Tests/Integration/MSFT_xEnvironmentResource.config.ps1 b/Tests/Integration/MSFT_xEnvironmentResource.config.ps1 index 2e0c09711..a6e05be1f 100644 --- a/Tests/Integration/MSFT_xEnvironmentResource.config.ps1 +++ b/Tests/Integration/MSFT_xEnvironmentResource.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] @@ -13,15 +13,15 @@ Configuration $ConfigurationName [ValidateNotNullOrEmpty()] [String] $Name, - + [ValidateNotNull()] [String] $Value = [String]::Empty, - + [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', - + [Boolean] $Path = $false, diff --git a/Tests/Integration/MSFT_xGroupResource.Integration.Tests.ps1 b/Tests/Integration/MSFT_xGroupResource.Integration.Tests.ps1 index 814ca8882..1f657e6e5 100644 --- a/Tests/Integration/MSFT_xGroupResource.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_xGroupResource.Integration.Tests.ps1 @@ -1,4 +1,4 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")] param () $errorActionPreference = 'Stop' @@ -23,7 +23,7 @@ try $script:confgurationNoMembersFilePath = Join-Path -Path $PSScriptRoot -ChildPath 'MSFT_xGroupResource_NoMembers.config.ps1' $script:confgurationWithMembersFilePath = Join-Path -Path $PSScriptRoot -ChildPath 'MSFT_xGroupResource_Members.config.ps1' $script:confgurationWithMembersToIncludeExcludeFilePath = Join-Path -Path $PSScriptRoot -ChildPath 'MSFT_xGroupResource_MembersToIncludeExclude.config.ps1' - + # Fake users for testing $testUsername1 = 'TestUser1' $testUsername2 = 'TestUser2' @@ -60,7 +60,7 @@ try try { - { + { . $script:confgurationWithMembersFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -88,7 +88,7 @@ try Test-GroupExists -GroupName $testGroupName | Should Be $true - { + { . $script:confgurationNoMembersFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -109,7 +109,7 @@ try Test-GroupExists -GroupName $testGroupName | Should Be $true - { + { . $script:confgurationWithMembersToIncludeExcludeFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -134,7 +134,7 @@ try try { - { + { . $script:confgurationWithMembersFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -176,7 +176,7 @@ try try { - { + { . $script:confgurationWithMembersToIncludeExcludeFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -218,7 +218,7 @@ try try { - { + { . $script:confgurationWithMembersToIncludeExcludeFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -252,7 +252,7 @@ try try { - { + { . $script:confgurationWithMembersFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force diff --git a/Tests/Integration/MSFT_xGroupResource_Members.config.ps1 b/Tests/Integration/MSFT_xGroupResource_Members.config.ps1 index 3c0053054..7bb26f7fa 100644 --- a/Tests/Integration/MSFT_xGroupResource_Members.config.ps1 +++ b/Tests/Integration/MSFT_xGroupResource_Members.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/MSFT_xGroupResource_MembersToIncludeExclude.config.ps1 b/Tests/Integration/MSFT_xGroupResource_MembersToIncludeExclude.config.ps1 index 49435c167..c9746b166 100644 --- a/Tests/Integration/MSFT_xGroupResource_MembersToIncludeExclude.config.ps1 +++ b/Tests/Integration/MSFT_xGroupResource_MembersToIncludeExclude.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/MSFT_xGroupResource_NoMembers.config.ps1 b/Tests/Integration/MSFT_xGroupResource_NoMembers.config.ps1 index 58f5f588a..cfcfdcdf1 100644 --- a/Tests/Integration/MSFT_xGroupResource_NoMembers.config.ps1 +++ b/Tests/Integration/MSFT_xGroupResource_NoMembers.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/MSFT_xMsiPackage.EndToEnd.Tests.ps1 b/Tests/Integration/MSFT_xMsiPackage.EndToEnd.Tests.ps1 index cc9f16838..09c870e34 100644 --- a/Tests/Integration/MSFT_xMsiPackage.EndToEnd.Tests.ps1 +++ b/Tests/Integration/MSFT_xMsiPackage.EndToEnd.Tests.ps1 @@ -1,4 +1,4 @@ -<# +<# Please note that some of these tests depend on each other. They must be run in the order given - if one test fails, subsequent tests may also fail. @@ -36,7 +36,7 @@ Describe 'xMsiPackage End to End Tests' { <# This log file is used to log messages from the mock server which is important for debugging since - most of the work of the mock server is done within a separate process. + most of the work of the mock server is done within a separate process. #> $script:logFile = Join-Path -Path $PSScriptRoot -ChildPath 'PackageTestLogFile.txt' $script:environmentInIncorrectStateErrorMessage = 'The current environment is not in the expected state for this test - either something was setup incorrectly on your machine or a previous test failed - results after this may be invalid.' @@ -78,7 +78,7 @@ Describe 'xMsiPackage End to End Tests' { } It 'Should return True from Test-TargetResource with the same parameters before configuration' { - $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters + $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters $testTargetResourceInitialResult | Should Be $true if ($testTargetResourceInitialResult -ne $true) @@ -97,7 +97,7 @@ Describe 'xMsiPackage End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:configurationFilePathNoOptionalParameters -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @msiPackageParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -123,7 +123,7 @@ Describe 'xMsiPackage End to End Tests' { } It 'Should return False from Test-TargetResource with the same parameters before configuration' { - $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters + $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters $testTargetResourceInitialResult | Should Be $false if ($testTargetResourceInitialResult -ne $false) @@ -142,7 +142,7 @@ Describe 'xMsiPackage End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:configurationFilePathNoOptionalParameters -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @msiPackageParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -168,7 +168,7 @@ Describe 'xMsiPackage End to End Tests' { } It 'Should return True from Test-TargetResource with the same parameters before configuration' { - $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters + $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters $testTargetResourceInitialResult | Should Be $true if ($testTargetResourceInitialResult -ne $true) @@ -187,7 +187,7 @@ Describe 'xMsiPackage End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:configurationFilePathNoOptionalParameters -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @msiPackageParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -213,7 +213,7 @@ Describe 'xMsiPackage End to End Tests' { } It 'Should return False from Test-TargetResource with the same parameters before configuration' { - $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters + $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters $testTargetResourceInitialResult | Should Be $false if ($testTargetResourceInitialResult -ne $false) @@ -232,7 +232,7 @@ Describe 'xMsiPackage End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:configurationFilePathNoOptionalParameters -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @msiPackageParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -266,7 +266,7 @@ Describe 'xMsiPackage End to End Tests' { } It 'Should return False from Test-TargetResource with the same parameters before configuration' { - $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters + $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters $testTargetResourceInitialResult | Should Be $false if ($testTargetResourceInitialResult -ne $false) @@ -285,7 +285,7 @@ Describe 'xMsiPackage End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:configurationFilePathLogPath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @msiPackageParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -323,7 +323,7 @@ Describe 'xMsiPackage End to End Tests' { } It 'Should return False from Test-TargetResource with the same parameters before configuration' { - $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters + $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters $testTargetResourceInitialResult | Should Be $false if ($testTargetResourceInitialResult -ne $false) @@ -342,7 +342,7 @@ Describe 'xMsiPackage End to End Tests' { } It 'Should compile and run configuration' { - { + { . $script:configurationFilePathLogPath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @msiPackageParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -359,7 +359,7 @@ Describe 'xMsiPackage End to End Tests' { It 'Package should not exist on the machine' { Test-PackageInstalledById -ProductId $script:packageId | Should Be $false - } + } } Context 'Install package from HTTP Url' { @@ -378,7 +378,7 @@ Describe 'xMsiPackage End to End Tests' { } It 'Should return False from Test-TargetResource with the same parameters before configuration' { - $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters + $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters $testTargetResourceInitialResult | Should Be $false if ($testTargetResourceInitialResult -ne $false) @@ -400,12 +400,12 @@ Describe 'xMsiPackage End to End Tests' { { $serverResult = Start-Server -FilePath $script:msiLocation -LogPath $script:logFile -Https $false $fileServerStarted = $serverResult.FileServerStarted - $job = $serverResult.Job + $job = $serverResult.Job $fileServerStarted.WaitOne(30000) It 'Should compile and run configuration' { - { + { . $script:configurationFilePathNoOptionalParameters -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @msiPackageParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -446,7 +446,7 @@ Describe 'xMsiPackage End to End Tests' { } It 'Should return False from Test-TargetResource with the same parameters before configuration' { - $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters + $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters $testTargetResourceInitialResult | Should Be $false if ($testTargetResourceInitialResult -ne $false) @@ -463,7 +463,7 @@ Describe 'xMsiPackage End to End Tests' { It 'Package should exist on the machine before configuration is run' { Test-PackageInstalledById -ProductId $script:packageId | Should Be $true } - + try { $serverResult = Start-Server -FilePath $script:msiLocation -LogPath $script:logFile -Https $false @@ -473,7 +473,7 @@ Describe 'xMsiPackage End to End Tests' { $fileServerStarted.WaitOne(30000) It 'Should compile and run configuration' { - { + { . $script:configurationFilePathNoOptionalParameters -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @msiPackageParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -514,7 +514,7 @@ Describe 'xMsiPackage End to End Tests' { } It 'Should return False from Test-TargetResource with the same parameters before configuration' { - $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters + $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters $testTargetResourceInitialResult | Should Be $false if ($testTargetResourceInitialResult -ne $false) @@ -531,7 +531,7 @@ Describe 'xMsiPackage End to End Tests' { It 'Package should not exist on the machine before configuration is run' { Test-PackageInstalledById -ProductId $script:packageId | Should Be $false } - + try { $serverResult = Start-Server -FilePath $script:msiLocation -LogPath $script:logFile -Https $true @@ -541,7 +541,7 @@ Describe 'xMsiPackage End to End Tests' { $fileServerStarted.WaitOne(30000) It 'Should compile and run configuration' { - { + { . $script:configurationFilePathNoOptionalParameters -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @msiPackageParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -565,7 +565,7 @@ Describe 'xMsiPackage End to End Tests' { Test-PackageInstalledById -ProductId $script:packageId | Should Be $true } } - + Context 'Uninstall Msi package from HTTPS Url' { $configurationName = 'UninstallMsiPackageFromHttps' @@ -582,7 +582,7 @@ Describe 'xMsiPackage End to End Tests' { } It 'Should return False from Test-TargetResource with the same parameters before configuration' { - $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters + $testTargetResourceInitialResult = MSFT_xMsiPackage\Test-TargetResource @msiPackageParameters $testTargetResourceInitialResult | Should Be $false if ($testTargetResourceInitialResult -ne $false) @@ -609,7 +609,7 @@ Describe 'xMsiPackage End to End Tests' { $fileServerStarted.WaitOne(30000) It 'Should compile and run configuration' { - { + { . $script:configurationFilePathNoOptionalParameters -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @msiPackageParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force diff --git a/Tests/Integration/MSFT_xMsiPackage.Integration.Tests.ps1 b/Tests/Integration/MSFT_xMsiPackage.Integration.Tests.ps1 index 793d0b32f..9b02c3c0b 100644 --- a/Tests/Integration/MSFT_xMsiPackage.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_xMsiPackage.Integration.Tests.ps1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' $script:testsFolderFilePath = Split-Path $PSScriptRoot -Parent @@ -28,7 +28,7 @@ try <# This log file is used to log messages from the mock server which is important for debugging since - most of the work of the mock server is done within a separate process. + most of the work of the mock server is done within a separate process. #> $script:logFile = Join-Path -Path $PSScriptRoot -ChildPath 'PackageTestLogFile.txt' @@ -211,7 +211,7 @@ try $serverResult = Start-Server -FilePath $script:msiLocation -LogPath $script:logFile -Https $true $fileServerStarted = $serverResult.FileServerStarted - $job = $serverResult.Job + $job = $serverResult.Job # Wait for the file server to be ready to receive requests $fileServerStarted.WaitOne(30000) diff --git a/Tests/Integration/MSFT_xMsiPackage_LogPath.ps1 b/Tests/Integration/MSFT_xMsiPackage_LogPath.ps1 index 2076eb712..f520efd21 100644 --- a/Tests/Integration/MSFT_xMsiPackage_LogPath.ps1 +++ b/Tests/Integration/MSFT_xMsiPackage_LogPath.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/MSFT_xMsiPackage_NoOptionalParameters.ps1 b/Tests/Integration/MSFT_xMsiPackage_NoOptionalParameters.ps1 index 8be9dfd96..16e909846 100644 --- a/Tests/Integration/MSFT_xMsiPackage_NoOptionalParameters.ps1 +++ b/Tests/Integration/MSFT_xMsiPackage_NoOptionalParameters.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/MSFT_xPackageResource.Integration.Tests.ps1 b/Tests/Integration/MSFT_xPackageResource.Integration.Tests.ps1 index fed2ed604..622062c57 100644 --- a/Tests/Integration/MSFT_xPackageResource.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_xPackageResource.Integration.Tests.ps1 @@ -1,4 +1,4 @@ -Import-Module "$PSScriptRoot\..\CommonTestHelper.psm1" +Import-Module "$PSScriptRoot\..\CommonTestHelper.psm1" $script:testEnvironment = Enter-DscResourceTestEnvironment ` -DscResourceModuleName 'xPSDesiredStateConfiguration' ` diff --git a/Tests/Integration/MSFT_xRegistryResource.EndToEnd.Tests.ps1 b/Tests/Integration/MSFT_xRegistryResource.EndToEnd.Tests.ps1 index 11508afba..3fc63dc70 100644 --- a/Tests/Integration/MSFT_xRegistryResource.EndToEnd.Tests.ps1 +++ b/Tests/Integration/MSFT_xRegistryResource.EndToEnd.Tests.ps1 @@ -1,4 +1,4 @@ -<# +<# WARNING: DO NOT RUN THESE TESTS ON A VALUABLE MACHINE! Running on a disposable VM or AppVeyor is strongly recommended. If these tests go awry, your machine's registry could be corrupted which will brick your machine! @@ -47,7 +47,7 @@ try } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathKeyAndNameOnly -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @registryParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -79,7 +79,7 @@ try } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathKeyAndNameOnly -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @registryParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -117,7 +117,7 @@ try } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathWithDataAndType -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @registryParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -177,7 +177,7 @@ try } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathWithDataAndType -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @registryParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -218,7 +218,7 @@ try $expectedRegistryKeyValue = [Byte[]]@(0) It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathWithDataAndType -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @registryParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -254,7 +254,7 @@ try } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathKeyAndNameOnly -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @registryParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -288,7 +288,7 @@ try } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathWithDataAndType -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @registryParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -320,7 +320,7 @@ try } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePathKeyAndNameOnly -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @registryParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -347,4 +347,4 @@ finally { Exit-DscResourceTestEnvironment -TestEnvironment $script:testEnvironment } - + diff --git a/Tests/Integration/MSFT_xRegistryResource.Integration.Tests.ps1 b/Tests/Integration/MSFT_xRegistryResource.Integration.Tests.ps1 index f8dea4665..34289ccaa 100644 --- a/Tests/Integration/MSFT_xRegistryResource.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_xRegistryResource.Integration.Tests.ps1 @@ -1,4 +1,4 @@ -<# +<# WARNING: DO NOT RUN THESE TESTS ON A VALUABLE MACHINE! Running on a disposable VM or AppVeyor is strongly recommended. If these tests go awry, your machine's registry could be corrupted which will brick your machine! @@ -88,14 +88,14 @@ try } It 'Should return Present when retrieving an existing value from an existing registry key' { - $registryKeyPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' + $registryKeyPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' $registryValueName = 'Path' $getTargetResourceResult = Get-TargetResource -Key $registryKeyPath -ValueName $registryValueName $getTargetResourceResult.Ensure | Should Be 'Present' } It 'Should return Absent when retrieving a nonexistant value from an existing registry key' { - $registryKeyPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' + $registryKeyPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' $registryValueName = 'PsychoPath' $getTargetResourceResult = Get-TargetResource -Key $registryKeyPath -ValueName $registryValueName $getTargetResourceResult.Ensure | Should Be 'Absent' @@ -137,7 +137,7 @@ try $registryKeyExists = Test-RegistryKeyExists -KeyPath $script:registryKeyPath $registryKeyExists | Should Be $true - # Now remove the TestKey + # Now remove the TestKey Set-TargetResource -Key $script:registryKeyPath -ValueName '' -Ensure 'Absent' # Verify that the registry key has been removed @@ -155,7 +155,7 @@ try $registryKeyExists = Test-RegistryKeyExists -KeyPath $registryKeyTreePath $registryKeyExists | Should Be $true - # Remove the test registry key tree + # Remove the test registry key tree Set-TargetResource -Key $registryKeyTreePath -ValueName '' -Ensure 'Absent' # Verify that the registry key tree has been removed @@ -167,8 +167,8 @@ try $valueName = 'TestValue' $valueData = 'TestData' $valueType = 'String' - - # Create the new registry key value + + # Create the new registry key value Set-TargetResource -Key $script:registryKeyPath -ValueName $valueName -ValueData $valueData -ValueType $valueType # Verify that the registry key value has been created with the correct data and type @@ -181,7 +181,7 @@ try $valueData = 'aabbcc' $valueType = 'Binary' - # Create the new registry key value + # Create the new registry key value Set-TargetResource -Key $script:registryKeyPath -ValueName $valueName -ValueData $valueData -ValueType $valueType -Hex $true # Verify that the registry key value has been created with the correct data and type @@ -193,7 +193,7 @@ try $valueName = '' $valueData = 'DefaultValue' - # Create the new registry key value + # Create the new registry key value Set-TargetResource -Key $script:registryKeyPath -ValueName $valueName -ValueData $valueData # Verify that the registry key value has been created with the correct data and type @@ -208,7 +208,7 @@ try # Create the test registry value New-RegistryValue -KeyPath $script:registryKeyPath -ValueName $valueName -ValueData $valueData -ValueType $valueType - + # Verify that the registry key value exists before removal $registryValueExists = Test-RegistryValueExists -KeyPath $script:registryKeyPath -ValueName $valueName $registryValueExists | Should Be $true @@ -228,7 +228,7 @@ try # Create the test registry value New-RegistryValue -KeyPath $script:registryKeyPath -ValueName '(default)' -ValueData $valueData -ValueType $valueType - + # Verify that the registry key value exists before removal $registryValueExists = Test-RegistryValueExists -KeyPath $script:registryKeyPath -ValueName '(default)' $registryValueExists | Should Be $true @@ -246,7 +246,7 @@ try $valueName = 'Testing' $valueData = 'TestValue' - # Create the new registry key value + # Create the new registry key value Set-TargetResource -Key $registryKeyPathWithForwardSlashes -ValueName $valueName -ValueData $valueData # Verify that the registry key value has been created with the correct data and type @@ -275,7 +275,7 @@ try } It 'Should return false for a registry value that does not exist' { - $registryKeyPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' + $registryKeyPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' $valueName = 'NonExisting' $testTargetResourceResult = Test-TargetResource -Key $registryKeyPath -ValueName $valueName $testTargetResourceResult | Should Be $false @@ -284,13 +284,13 @@ try It 'Should return true when Ensure is Absent and registry key does not exist' { $registryKeyPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environmentally' $testTargetResourceResult = Test-TargetResource -Key $registryKeyPath -ValueName '' -Ensure 'Absent' - $testTargetResourceResult | Should Be $true + $testTargetResourceResult | Should Be $true } It 'Should return false when Ensure is Absent and registry key exists' { $registryKeyPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' $testTargetResourceResult = Test-TargetResource -Key $registryKeyPath -ValueName '' -Ensure 'Absent' - $testTargetResourceResult | Should Be $false + $testTargetResourceResult | Should Be $false } It 'Should return false when Ensure is Absent and registry value exists with invalid data' { @@ -299,7 +299,7 @@ try $valueData = 'FakePath' $testTargetResourceResult = Test-TargetResource -Key $registryKeyPath -ValueName $valueName -ValueData $valueData -Ensure 'Absent' - $testTargetResourceResult | Should Be $false + $testTargetResourceResult | Should Be $false } It 'Should return true for a multi-string registry value' { diff --git a/Tests/Integration/MSFT_xRegistryResource_KeyAndNameOnly.config.ps1 b/Tests/Integration/MSFT_xRegistryResource_KeyAndNameOnly.config.ps1 index 24dc13ba6..5664b5ec3 100644 --- a/Tests/Integration/MSFT_xRegistryResource_KeyAndNameOnly.config.ps1 +++ b/Tests/Integration/MSFT_xRegistryResource_KeyAndNameOnly.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/MSFT_xRegistryResource_WithDataAndType.config.ps1 b/Tests/Integration/MSFT_xRegistryResource_WithDataAndType.config.ps1 index c4550e93b..ef915a0fc 100644 --- a/Tests/Integration/MSFT_xRegistryResource_WithDataAndType.config.ps1 +++ b/Tests/Integration/MSFT_xRegistryResource_WithDataAndType.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/MSFT_xScriptResource.Integration.Tests.ps1 b/Tests/Integration/MSFT_xScriptResource.Integration.Tests.ps1 index 9906879a5..a94199764 100644 --- a/Tests/Integration/MSFT_xScriptResource.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_xScriptResource.Integration.Tests.ps1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import CommonTestHelper for Enter-DscResourceTestEnvironment, Exit-DscResourceTestEnvironment @@ -52,7 +52,7 @@ try # Cannot use $TestDrive here because script is run outside of Pester $resourceParameters = @{ FilePath = $script:testFilePath - FileContent = 'Test file content' + FileContent = 'Test file content' } It 'Should have removed test file before config runs' { @@ -60,7 +60,7 @@ try } It 'Should compile and apply the MOF without throwing' { - { + { . $script:configurationNoCredentialFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -83,7 +83,7 @@ try } $configurationName = 'TestScriptWithCredential' - + # Cannot use $TestDrive here because script is run outside of Pester $resourceParameters = @{ FilePath = $script:testFilePath @@ -106,7 +106,7 @@ try } It 'Should compile and apply the MOF without throwing' { - { + { . $script:configurationWithCredentialFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive -ConfigurationData $configData @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force diff --git a/Tests/Integration/MSFT_xScriptResource_NoCredential.config.ps1 b/Tests/Integration/MSFT_xScriptResource_NoCredential.config.ps1 index 3463232cb..cfad58bad 100644 --- a/Tests/Integration/MSFT_xScriptResource_NoCredential.config.ps1 +++ b/Tests/Integration/MSFT_xScriptResource_NoCredential.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/MSFT_xScriptResource_WithCredential.config.ps1 b/Tests/Integration/MSFT_xScriptResource_WithCredential.config.ps1 index 6cbc9560d..2fdf43ef5 100644 --- a/Tests/Integration/MSFT_xScriptResource_WithCredential.config.ps1 +++ b/Tests/Integration/MSFT_xScriptResource_WithCredential.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/MSFT_xUserResource.config.ps1 b/Tests/Integration/MSFT_xUserResource.config.ps1 index 63deb8d7b..673fff21b 100644 --- a/Tests/Integration/MSFT_xUserResource.config.ps1 +++ b/Tests/Integration/MSFT_xUserResource.config.ps1 @@ -1,37 +1,37 @@ - + # Integration Test Config Template Version 1.0.0 -param +param ( [Parameter(Mandatory)] [System.String] $ConfigurationName ) - + Configuration $ConfigurationName { - param - ( + param + ( [System.String] $UserName = 'Test UserName', - + [System.String] $Description = 'Test Description', - + [System.String] $FullName = 'Test Full Name', - + [ValidateSet('Present', 'Absent')] [System.String] $Ensure = 'Present', - + [Parameter(Mandatory)] [System.Management.Automation.PSCredential] $Password ) - + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - + Node Localhost { xUser UserResource1 diff --git a/Tests/Integration/MSFT_xWindowsFeature.Integration.Tests.ps1 b/Tests/Integration/MSFT_xWindowsFeature.Integration.Tests.ps1 index 589708b36..d0a2635e1 100644 --- a/Tests/Integration/MSFT_xWindowsFeature.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_xWindowsFeature.Integration.Tests.ps1 @@ -1,9 +1,9 @@ -<# +<# Integration tests for Installing/uninstalling a Windows Feature. Currently Telnet-Client is set as the feature to test since it's fairly small and doesn't require a restart. RSAT-File-Services is set as the feature to test installing/uninstalling a feature with subfeatures. -#> +#> # Suppressing this rule since we need to create a plaintext password to test this resource [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] @@ -94,7 +94,7 @@ try { It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $script:testFeatureName @@ -143,7 +143,7 @@ try { It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $script:testFeatureName @@ -196,7 +196,7 @@ try { It 'Should be able to call Get-DscConfiguration without throwing' -Skip:$script:skipLongTests { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' -Skip:$script:skipLongTests { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $script:testFeatureWithSubFeaturesName @@ -237,7 +237,7 @@ try { It 'Should be able to call Get-DscConfiguration without throwing' -Skip:$script:skipLongTests { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw } - + It 'Should return the correct configuration' -Skip:$script:skipLongTests { $currentConfig = Get-DscConfiguration -ErrorAction 'Stop' $currentConfig.Name | Should Be $script:testFeatureWithSubFeaturesName diff --git a/Tests/Integration/MSFT_xWindowsFeature.config.ps1 b/Tests/Integration/MSFT_xWindowsFeature.config.ps1 index bb0d8b80d..cd7dff2a6 100644 --- a/Tests/Integration/MSFT_xWindowsFeature.config.ps1 +++ b/Tests/Integration/MSFT_xWindowsFeature.config.ps1 @@ -1,17 +1,17 @@ - -param + +param ( [Parameter(Mandatory)] [System.String] $ConfigurationName ) - + Configuration $ConfigurationName { - param - ( - [Parameter(Mandatory = $true)] + param + ( + [Parameter(Mandatory = $true)] [System.String] $Name, @@ -22,9 +22,9 @@ Configuration $ConfigurationName [System.Boolean] $IncludeAllSubFeature = $false ) - + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - + Node Localhost { xWindowsFeature WindowsFeatureTest diff --git a/Tests/Integration/MSFT_xWindowsOptionalFeature.Integration.Tests.ps1 b/Tests/Integration/MSFT_xWindowsOptionalFeature.Integration.Tests.ps1 index d943c634f..c908d2fe2 100644 --- a/Tests/Integration/MSFT_xWindowsOptionalFeature.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_xWindowsOptionalFeature.Integration.Tests.ps1 @@ -1,4 +1,4 @@ -Import-Module -Name (Join-Path -Path (Split-Path $PSScriptRoot -Parent) -ChildPath 'CommonTestHelper.psm1') +Import-Module -Name (Join-Path -Path (Split-Path $PSScriptRoot -Parent) -ChildPath 'CommonTestHelper.psm1') $script:testEnvironment = Enter-DscResourceTestEnvironment ` -DscResourceModuleName 'xPSDesiredStateConfiguration' ` @@ -14,7 +14,7 @@ try $script:confgurationFilePath = Join-Path -Path $PSScriptRoot -ChildPath 'MSFT_xWindowsOptionalFeature.config.ps1' } - + It 'Should enable a valid Windows optional feature' { $configurationName = 'EnableWindowsOptionalFeature' @@ -34,7 +34,7 @@ try Dism\Disable-WindowsOptionalFeature -FeatureName $resourceParameters.Name -Online -NoRestart } - { + { . $script:confgurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -83,7 +83,7 @@ try Dism\Enable-WindowsOptionalFeature -FeatureName $resourceParameters.Name -Online -NoRestart } - { + { . $script:confgurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -126,7 +126,7 @@ try try { - { + { . $script:confgurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force diff --git a/Tests/Integration/MSFT_xWindowsOptionalFeature.config.ps1 b/Tests/Integration/MSFT_xWindowsOptionalFeature.config.ps1 index 3e3561f33..c4650c772 100644 --- a/Tests/Integration/MSFT_xWindowsOptionalFeature.config.ps1 +++ b/Tests/Integration/MSFT_xWindowsOptionalFeature.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/MSFT_xWindowsPackageCab.Integration.Tests.ps1 b/Tests/Integration/MSFT_xWindowsPackageCab.Integration.Tests.ps1 index 1bedb0737..cad1fa06d 100644 --- a/Tests/Integration/MSFT_xWindowsPackageCab.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_xWindowsPackageCab.Integration.Tests.ps1 @@ -1,4 +1,4 @@ -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath 'CommonTestHelper.psm1') +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath 'CommonTestHelper.psm1') $script:testEnvironment = Enter-DscResourceTestEnvironment ` -DscResourceModuleName 'xPSDesiredStateConfiguration' ` @@ -10,11 +10,11 @@ try Describe 'xWindowsPackageCab Integration Tests' { BeforeAll { Import-Module -Name 'Dism' - + $script:installedStates = @( 'Installed', 'InstallPending' ) $script:confgurationFilePath = Join-Path -Path $PSScriptRoot -ChildPath 'MSFT_xWindowsPackageCab.config.ps1' - $script:testPackageName = '' + $script:testPackageName = '' $script:testSourcePath = Join-Path -Path $PSScriptRoot -ChildPath '' $script:cabPackageNotProvided = $script:testPackageName -eq [String]::Empty @@ -47,7 +47,7 @@ try { try { - $windowsPackage = Dism\Get-WindowsPackage -PackageName $script:testPackageName -Online + $windowsPackage = Dism\Get-WindowsPackage -PackageName $script:testPackageName -Online if ($null -ne $windowsPackage -and $windowsPackage.PackageState -in $script:installedStates) { Dism\Remove-WindowsPackage -PackageName $script:testPackageName.Name -Online -NoRestart @@ -59,7 +59,7 @@ try } } } - + It 'Should install a Windows package through a cab file' -Skip:$script:cabPackageNotProvided { $configurationName = 'InstallWindowsPackageCab' @@ -69,7 +69,7 @@ try Ensure = 'Present' } - { + { . $script:confgurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -95,7 +95,7 @@ try { $windowsPackage = Dism\Get-WindowsPackage -PackageName $resourceParameters.Name -Online } | Should Not Throw - { + { . $script:confgurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -116,7 +116,7 @@ try { Dism\Get-WindowsPackage -PackageName $resourceParameters.Name -Online } | Should Throw - { + { . $script:confgurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force diff --git a/Tests/Integration/MSFT_xWindowsPackageCab.config.ps1 b/Tests/Integration/MSFT_xWindowsPackageCab.config.ps1 index 8f0e78ed5..e0a465971 100644 --- a/Tests/Integration/MSFT_xWindowsPackageCab.config.ps1 +++ b/Tests/Integration/MSFT_xWindowsPackageCab.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/MSFT_xWindowsProcess.Integration.Tests.ps1 b/Tests/Integration/MSFT_xWindowsProcess.Integration.Tests.ps1 index 7c0c48569..8bb92912c 100644 --- a/Tests/Integration/MSFT_xWindowsProcess.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_xWindowsProcess.Integration.Tests.ps1 @@ -1,4 +1,4 @@ -<# +<# These tests should only be run in AppVeyor since the second half of the tests require the AppVeyor administrator account credential to run. diff --git a/Tests/Integration/MSFT_xWindowsProcess.config.ps1 b/Tests/Integration/MSFT_xWindowsProcess.config.ps1 index d1333f82c..6aa14ce07 100644 --- a/Tests/Integration/MSFT_xWindowsProcess.config.ps1 +++ b/Tests/Integration/MSFT_xWindowsProcess.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/MSFT_xWindowsProcessWithCredential.config.ps1 b/Tests/Integration/MSFT_xWindowsProcessWithCredential.config.ps1 index b629262bf..b4d8935d7 100644 --- a/Tests/Integration/MSFT_xWindowsProcessWithCredential.config.ps1 +++ b/Tests/Integration/MSFT_xWindowsProcessWithCredential.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/xGroupSet.Integration.Tests.ps1 b/Tests/Integration/xGroupSet.Integration.Tests.ps1 index e351a1d00..5577c34ae 100644 --- a/Tests/Integration/xGroupSet.Integration.Tests.ps1 +++ b/Tests/Integration/xGroupSet.Integration.Tests.ps1 @@ -1,4 +1,4 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")] param () $errorActionPreference = 'Stop' @@ -64,7 +64,7 @@ try try { - { + { . $script:confgurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @groupSetParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -103,7 +103,7 @@ try try { - { + { . $script:confgurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @groupSetParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -139,7 +139,7 @@ try try { - { + { . $script:confgurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @groupSetParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -159,7 +159,7 @@ try It 'Should remove two members from a set of three groups' { $configurationName = 'RemoveTwoMembersFromThreeGroups' - + $testGroupNames = @('TestGroupWithMembersToExclude1', 'TestGroupWithMembersToExclude2', 'TestGroupWithMembersToExclude3') $groupMembersToExclude = @( $testUsername2, $testUsername3 ) @@ -181,7 +181,7 @@ try try { - { + { . $script:confgurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @groupSetParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -206,7 +206,7 @@ try It 'Should remove a set of groups' { $configurationName = 'RemoveThreeGroups' - + $testGroupNames = @('TestGroupRemove1', 'TestGroupRemove2', 'TestGroupRemove3') $groupSetParameters = @{ @@ -226,7 +226,7 @@ try try { - { + { . $script:confgurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @groupSetParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force diff --git a/Tests/Integration/xGroupSet.config.ps1 b/Tests/Integration/xGroupSet.config.ps1 index 9540abe56..13bf27610 100644 --- a/Tests/Integration/xGroupSet.config.ps1 +++ b/Tests/Integration/xGroupSet.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/xProcessSet.Integration.Tests.ps1 b/Tests/Integration/xProcessSet.Integration.Tests.ps1 index 50c001984..310fa145e 100644 --- a/Tests/Integration/xProcessSet.Integration.Tests.ps1 +++ b/Tests/Integration/xProcessSet.Integration.Tests.ps1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import CommonTestHelper for Enter-DscResourceTestEnvironment, Exit-DscResourceTestEnvironment @@ -71,7 +71,7 @@ try } It 'Should compile and run configuration' { - { + { . $script:configurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @processSetParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -122,7 +122,7 @@ try } It 'Should compile and run configuration' { - { + { . $script:configurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @processSetParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force diff --git a/Tests/Integration/xProcessSet.config.ps1 b/Tests/Integration/xProcessSet.config.ps1 index b3c934638..b582bc93c 100644 --- a/Tests/Integration/xProcessSet.config.ps1 +++ b/Tests/Integration/xProcessSet.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/xServiceSet.Integration.Tests.ps1 b/Tests/Integration/xServiceSet.Integration.Tests.ps1 index 0e97d2c17..2fe6e0c2c 100644 --- a/Tests/Integration/xServiceSet.Integration.Tests.ps1 +++ b/Tests/Integration/xServiceSet.Integration.Tests.ps1 @@ -1,4 +1,4 @@ -<# +<# These tests should only be run in AppVeyor since they currently require the AppVeyor administrator account credential to run. @@ -138,7 +138,7 @@ try } It 'Should compile and apply the MOF without throwing' { - { + { . $script:confgurationFilePathAllExceptBuiltInAccount -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive -ConfigurationData $configData @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -180,7 +180,7 @@ try } It 'Should compile and apply the MOF without throwing' { - { + { . $script:confgurationFilePathBuiltInAccountOnly -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -225,7 +225,7 @@ try } It 'Should compile and apply the MOF without throwing' { - { + { . $script:confgurationFilePathBuiltInAccountOnly -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @resourceParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force diff --git a/Tests/Integration/xServiceSet_AllExceptBuiltInAccount.config.ps1 b/Tests/Integration/xServiceSet_AllExceptBuiltInAccount.config.ps1 index f7a933a0c..b84a7d75e 100644 --- a/Tests/Integration/xServiceSet_AllExceptBuiltInAccount.config.ps1 +++ b/Tests/Integration/xServiceSet_AllExceptBuiltInAccount.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] @@ -44,7 +44,7 @@ Configuration $ConfigurationName Ensure = $Ensure Credential = $Credential State = $State - StartupType = $StartupType + StartupType = $StartupType } } } diff --git a/Tests/Integration/xServiceSet_BuiltInAccountOnly.config.ps1 b/Tests/Integration/xServiceSet_BuiltInAccountOnly.config.ps1 index 6a895f027..08b041453 100644 --- a/Tests/Integration/xServiceSet_BuiltInAccountOnly.config.ps1 +++ b/Tests/Integration/xServiceSet_BuiltInAccountOnly.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/xWindowsFeatureSet.Integration.Tests.ps1 b/Tests/Integration/xWindowsFeatureSet.Integration.Tests.ps1 index 080e8ce9b..d4c94f77d 100644 --- a/Tests/Integration/xWindowsFeatureSet.Integration.Tests.ps1 +++ b/Tests/Integration/xWindowsFeatureSet.Integration.Tests.ps1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import CommonTestHelper for Enter-DscResourceTestEnvironment, Exit-DscResourceTestEnvironment @@ -80,7 +80,7 @@ try { } It 'Should compile and run configuration' { - { + { . $script:configurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @windowsFeatureSetParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -111,7 +111,7 @@ try { $windowsFeature.Installed | Should Be $true } } - + It 'Should have created the log file' { Test-Path -Path $windowsFeatureSetParameters.LogPath | Should Be $true } @@ -159,7 +159,7 @@ try { } It 'Should compile and run configuration' { - { + { . $script:configurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @windowsFeatureSetParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -190,7 +190,7 @@ try { $windowsFeature.Installed | Should Be $false } } - + It 'Should have created the log file' { Test-Path -Path $windowsFeatureSetParameters.LogPath | Should Be $true } diff --git a/Tests/Integration/xWindowsFeatureSet.config.ps1 b/Tests/Integration/xWindowsFeatureSet.config.ps1 index 635697443..6b7fb8f39 100644 --- a/Tests/Integration/xWindowsFeatureSet.config.ps1 +++ b/Tests/Integration/xWindowsFeatureSet.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/Integration/xWindowsOptionalFeatureSet.Integration.Tests.ps1 b/Tests/Integration/xWindowsOptionalFeatureSet.Integration.Tests.ps1 index 8970ebc55..46899f142 100644 --- a/Tests/Integration/xWindowsOptionalFeatureSet.Integration.Tests.ps1 +++ b/Tests/Integration/xWindowsOptionalFeatureSet.Integration.Tests.ps1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import CommonTestHelper for Enter-DscResourceTestEnvironment, Exit-DscResourceTestEnvironment @@ -87,7 +87,7 @@ try } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @wofSetParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -115,7 +115,7 @@ try $windowsOptionalFeature.State -in $script:enabledStates | Should Be $true } } - + It 'Should have created the log file' { Test-Path -Path $wofSetParameters.LogPath | Should Be $true } @@ -163,7 +163,7 @@ try } It 'Should compile and run configuration' { - { + { . $script:confgurationFilePath -ConfigurationName $configurationName & $configurationName -OutputPath $TestDrive @wofSetParameters Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force @@ -191,7 +191,7 @@ try $windowsOptionalFeature.State -in $script:disabledStates | Should Be $true } } - + It 'Should have created the log file' { Test-Path -Path $wofSetParameters.LogPath | Should Be $true } diff --git a/Tests/Integration/xWindowsOptionalFeatureSet.config.ps1 b/Tests/Integration/xWindowsOptionalFeatureSet.config.ps1 index 9605a5ef1..9d63d7ca9 100644 --- a/Tests/Integration/xWindowsOptionalFeatureSet.config.ps1 +++ b/Tests/Integration/xWindowsOptionalFeatureSet.config.ps1 @@ -1,4 +1,4 @@ -param +param ( [Parameter(Mandatory = $true)] [String] diff --git a/Tests/MSFT_xGroupResource.TestHelper.psm1 b/Tests/MSFT_xGroupResource.TestHelper.psm1 index f82e02c56..17cf1e6ae 100644 --- a/Tests/MSFT_xGroupResource.TestHelper.psm1 +++ b/Tests/MSFT_xGroupResource.TestHelper.psm1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' #Import CommonResourceHelper for Test-IsNanoServer diff --git a/Tests/MSFT_xPackageResource.TestHelper.psm1 b/Tests/MSFT_xPackageResource.TestHelper.psm1 index c8a2c9e06..035351d07 100644 --- a/Tests/MSFT_xPackageResource.TestHelper.psm1 +++ b/Tests/MSFT_xPackageResource.TestHelper.psm1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' <# @@ -82,7 +82,7 @@ function Start-Server 'HttpIntegrationTest.FileServerStarted') $null = $fileServerStarted.Reset() - <# + <# The server is run on a separate process so that it can receive requests while the tests continue to run. It takes in the same parameterss that are passed in to this function. All helper functions that the server uses have to be @@ -109,7 +109,7 @@ function Start-Server ( [Parameter(Mandatory = $true)] [System.Net.HttpListener] - $HttpListener, + $HttpListener, [Parameter(Mandatory = $true)] [System.Boolean] @@ -117,7 +117,7 @@ function Start-Server ) Write-Log -LogFile $LogPath -Message 'Finished listening for requests. Shutting down HTTP server.' - + $ipPort = '0.0.0.0:1243' if ($null -eq $HttpListener) @@ -168,7 +168,7 @@ function Start-Server # Create certificate $certificate = New-SelfSignedCertificate -CertStoreLocation 'Cert:\LocalMachine\My' -DnsName localhost Write-Log -LogFile $LogPath -Message 'Created certificate' - + $hash = $certificate.Thumbprint $certPassword = ConvertTo-SecureString -String 'password12345' -AsPlainText -Force $tempPath = 'C:\certForTesting' @@ -176,9 +176,9 @@ function Start-Server $null = Export-PfxCertificate -Cert $certificate -FilePath $tempPath -Password $certPassword $null = Import-PfxCertificate -CertStoreLocation 'Cert:\LocalMachine\Root' -FilePath 'C:\certForTesting' -Password $certPassword Remove-Item -Path $tempPath - + Write-Log -LogFile $LogPath -Message 'Finished importing certificate into root. About to bind it to port.' - + # Use net shell command to directly bind certificate to designated testing port $null = netsh http add sslcert ipport=0.0.0.0:1243 certhash=$hash appid='{833f13c2-319a-4799-9d1a-5b267a0c3593}' clientcertnegotiation=enable } @@ -204,32 +204,32 @@ function Start-Server # Add the CallbackEventBridge type if it's not already defined if (-not ('CallbackEventBridge' -as [Type])) { - Add-Type @' - using System; - - public sealed class CallbackEventBridge { - public event AsyncCallback CallbackComplete = delegate { }; - - private CallbackEventBridge() {} - + Add-Type @' + using System; + + public sealed class CallbackEventBridge { + public event AsyncCallback CallbackComplete = delegate { }; + + private CallbackEventBridge() {} + private void CallbackInternal(IAsyncResult result) - { - CallbackComplete(result); - } - + { + CallbackComplete(result); + } + public AsyncCallback Callback - { - get { return new AsyncCallback(CallbackInternal); } - } - + { + get { return new AsyncCallback(CallbackInternal); } + } + public static CallbackEventBridge Create() - { - return new CallbackEventBridge(); - } - } + { + return new CallbackEventBridge(); + } + } '@ } - + $bridge = [CallbackEventBridge]::Create() Register-ObjectEvent -InputObject $bridge -EventName 'CallbackComplete' -Action $Callback -MessageData $args > $null $bridge.Callback @@ -249,7 +249,7 @@ function Start-Server .PARAMETER ScriptBlock The code to execute. - + #> function Invoke-ConsoleCommand { @@ -277,7 +277,7 @@ function Start-Server $message = ('Failed action ''{0}'' on target ''{1}'' (exit code {2}): {3}' -f $Action,$Target,$LASTEXITCODE,$output) Write-Error -Message $message Write-Log -LogFile $LogPath -Message "Error from Invoke-ConsoleCommand: $message" - } + } else { $nonNullOutput = $output | Where-Object { $_ -ne $null } @@ -309,7 +309,7 @@ function Start-Server [String] $Message ) - + $Message >> $LogFile } @@ -333,7 +333,7 @@ function Start-Server if ($Https) { $HttpListener.Prefixes.Add([Uri]'https://localhost:1243') - + try { Register-SSL @@ -374,7 +374,7 @@ function Start-Server .PARAMETER Result th IAsyncResult containing the listener object and path to the MSI file. - + #> $requestListener = { @@ -459,7 +459,7 @@ function Start-Server { $fileServerStarted.Dispose() } - + Write-Log -LogFile $LogPath -Message 'Stopping the Server' Stop-Listener -HttpListener $HttpListener -Https $Https } @@ -468,10 +468,10 @@ function Start-Server $job = Start-Job -ScriptBlock $server -ArgumentList @( $FilePath, $LogPath, $Https ) <# - Return the event object so that client knows when it can start sending requests and + Return the event object so that client knows when it can start sending requests and the job object so that the client can stop the job once it is done sending requests. #> - return @{ + return @{ FileServerStarted = $fileServerStarted Job = $job } @@ -501,7 +501,7 @@ function Stop-Server $FileServerStarted, [System.Management.Automation.Job] - $Job + $Job ) if ($null -ne $FileServerStarted) @@ -526,7 +526,7 @@ function Stop-Server function New-TestMsi { [CmdletBinding()] - param + param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] @@ -1131,7 +1131,7 @@ function Get-LocalizedRegistryKeyValue ) $localizedRegistryKeyValue = $RegistryKey.GetValue('{0}_Localized' -f $ValueName) - + if ($null -eq $localizedRegistryKeyValue) { $localizedRegistryKeyValue = $RegistryKey.GetValue($ValueName) @@ -1176,7 +1176,7 @@ function New-MockFileServer netsh advfirewall set allprofiles state off Start-Job -ArgumentList @( $FilePath ) -ScriptBlock { - + # Create certificate $certificate = Get-ChildItem -Path 'Cert:\LocalMachine\My' -Recurse | Where-Object { $_.EnhancedKeyUsageList.FriendlyName -eq 'Server Authentication' } @@ -1215,7 +1215,7 @@ function New-MockFileServer $pipe = New-Object -TypeName 'System.IO.Pipes.NamedPipeClientStream' -ArgumentList @( '\\.\pipe\dsctest1' ) $pipe.Connect() $pipe.Dispose() - + # Prepare binary buffer for http/https response $fileInfo = New-Object -TypeName 'System.IO.FileInfo' -ArgumentList @( $args[0] ) $numBytes = $fileInfo.Length @@ -1241,7 +1241,7 @@ function New-MockFileServer $httpListener.Close() # Close pipe - + # Use net shell command to clean up the certificate binding netsh http delete sslcert ipport=0.0.0.0:1243 } @@ -1265,7 +1265,7 @@ function New-TestExecutable [ValidateNotNullOrEmpty()] [String]$DestinationPath ) - + if (Test-Path -Path $DestinationPath) { Write-Verbose -Message "Removing old executable at $DestinationPath..." diff --git a/Tests/MSFT_xWindowsProcess.TestHelper.psm1 b/Tests/MSFT_xWindowsProcess.TestHelper.psm1 index 0fe4b339d..e8c201e7d 100644 --- a/Tests/MSFT_xWindowsProcess.TestHelper.psm1 +++ b/Tests/MSFT_xWindowsProcess.TestHelper.psm1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' <# diff --git a/Tests/Unit/CommonResourceHelper.Tests.ps1 b/Tests/Unit/CommonResourceHelper.Tests.ps1 index 7f308a042..38d5cdd69 100644 --- a/Tests/Unit/CommonResourceHelper.Tests.ps1 +++ b/Tests/Unit/CommonResourceHelper.Tests.ps1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' Describe 'CommonResourceHelper Unit Tests' { @@ -62,7 +62,7 @@ Describe 'CommonResourceHelper Unit Tests' { Context 'Computer OS type is Server and OS server level is not NanoServer' { Mock -CommandName 'Get-ComputerInfo' -MockWith { return $testComputerInfoServerNotNano } - + It 'Should not throw' { { $null = Test-IsNanoServer } | Should Not Throw } diff --git a/Tests/Unit/MSFT_xDSCWebService.Tests.ps1 b/Tests/Unit/MSFT_xDSCWebService.Tests.ps1 index 7de27705b..0d0114099 100644 --- a/Tests/Unit/MSFT_xDSCWebService.Tests.ps1 +++ b/Tests/Unit/MSFT_xDSCWebService.Tests.ps1 @@ -1,4 +1,4 @@ -$script:dscModuleName = 'xPSDesiredStateConfiguration' +$script:dscModuleName = 'xPSDesiredStateConfiguration' $script:dscResourceName = 'MSFT_xDSCWebService' #region HEADER @@ -171,7 +171,7 @@ try Context -Name 'DSC Web Service is installed without certificate' -Fixture { $script:result = $null - $ipProperties = [Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties() + $ipProperties = [Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties() if ($ipProperties.DomainName) { @@ -213,8 +213,8 @@ try } @{ Variable = 'DSCServerURL' - Data = '{0}://{1}:{2}/{3}' -f $websiteDataHTTP.bindings.collection[0].protocol, - $fqdnComputerName, + Data = '{0}://{1}:{2}/{3}' -f $websiteDataHTTP.bindings.collection[0].protocol, + $fqdnComputerName, ($websiteDataHTTP.bindings.collection[0].bindingInformation -split ':')[1], $serviceData.ServiceName } @@ -430,14 +430,14 @@ try It 'Should throw if CertificateThumbprint and CertificateSubject are not specifed' { $altTestParameters = $testParameters.Clone() $altTestParameters.Remove('CertificateThumbPrint') - - {$script:result = Get-TargetResource @altTestParameters} | Should Throw + + {$script:result = Get-TargetResource @altTestParameters} | Should Throw } It 'Should throw if CertificateThumbprint and CertificateSubject are both specifed' { $altTestParameters = $testParameters.Clone() $altTestParameters.Add('CertificateSubject', $certificateData[0].Subject) - {$script:result = Get-TargetResource @altTestParameters} | Should Throw + {$script:result = Get-TargetResource @altTestParameters} | Should Throw } } } @@ -445,7 +445,7 @@ try function Get-Website {} function Get-WebBinding {} - + #region Mocks $testArguments = 'if ($allowedArgs -notcontains $MyInvocation.Line.Trim()) {throw ''Mock test failed.''}' @@ -498,9 +498,9 @@ try DatabasePath = 'TestDrive:\Database' ConfigurationPath = 'TestDrive:\Configuration' ModulePath = 'TestDrive:\Module' - RegistrationKeyPath = 'TestDrive:\RegistrationKey' + RegistrationKeyPath = 'TestDrive:\RegistrationKey' } - + It 'Should call expected mocks' { Set-TargetResource @testParameters @setTargetPaths -Ensure Present @@ -524,7 +524,7 @@ try [Parameter(Mandatory)] [String] $Name, - + [Parameter(Mandatory)] [String] $Value @@ -537,7 +537,7 @@ try } Context -Name 'Ensure is Present - isDownLevelOfBlue' -Fixture { - + #region Mocks Mock -CommandName Get-OSVersion -MockWith {@{Major = 6; Minor = 2}} #endregion @@ -546,9 +546,9 @@ try DatabasePath = 'TestDrive:\Database' ConfigurationPath = 'TestDrive:\Configuration' ModulePath = 'TestDrive:\Module' - RegistrationKeyPath = 'TestDrive:\RegistrationKey' + RegistrationKeyPath = 'TestDrive:\RegistrationKey' } - + It 'Should call expected mocks' { Set-TargetResource @testParameters @setTargetPaths -Ensure Present @@ -566,7 +566,7 @@ try } Context -Name 'Ensure is Present - isUpLevelOfBlue' -Fixture { - + #region Mocks Mock -CommandName Get-OSVersion -MockWith {@{Major = 10; Minor = 0}} #endregion @@ -575,9 +575,9 @@ try DatabasePath = 'TestDrive:\Database' ConfigurationPath = 'TestDrive:\Configuration' ModulePath = 'TestDrive:\Module' - RegistrationKeyPath = 'TestDrive:\RegistrationKey' + RegistrationKeyPath = 'TestDrive:\RegistrationKey' } - + It 'Should call expected mocks' { Set-TargetResource @testParameters @setTargetPaths -Ensure Present @@ -599,9 +599,9 @@ try DatabasePath = 'TestDrive:\Database' ConfigurationPath = 'TestDrive:\Configuration' ModulePath = 'TestDrive:\Module' - RegistrationKeyPath = 'TestDrive:\RegistrationKey' + RegistrationKeyPath = 'TestDrive:\RegistrationKey' } - + It 'Should call expected mocks' { Set-TargetResource @testParameters @setTargetPaths -Ensure Present -Enable32BitAppOnWin64 $true @@ -629,9 +629,9 @@ try DatabasePath = 'TestDrive:\Database' ConfigurationPath = 'TestDrive:\Configuration' ModulePath = 'TestDrive:\Module' - RegistrationKeyPath = 'TestDrive:\RegistrationKey' + RegistrationKeyPath = 'TestDrive:\RegistrationKey' } - + It 'Should call expected mocks' { Set-TargetResource @testParameters @setTargetPaths -Ensure Present -AcceptSelfSignedCertificates $false @@ -671,9 +671,9 @@ try DatabasePath = 'TestDrive:\Database' ConfigurationPath = 'TestDrive:\Configuration' ModulePath = 'TestDrive:\Module' - RegistrationKeyPath = 'TestDrive:\RegistrationKey' + RegistrationKeyPath = 'TestDrive:\RegistrationKey' } - + It 'Should call expected mocks' { Set-TargetResource @altTestParameters @setTargetPaths -Ensure Present -CertificateSubject 'PesterTestCertificate' @@ -694,9 +694,9 @@ try DatabasePath = 'TestDrive:\Database' ConfigurationPath = 'TestDrive:\Configuration' ModulePath = 'TestDrive:\Module' - RegistrationKeyPath = 'TestDrive:\RegistrationKey' + RegistrationKeyPath = 'TestDrive:\RegistrationKey' } - + It 'Should not throw an error' { {Set-TargetResource @altTestParameters @setTargetPaths -Ensure Present} | Should not throw } @@ -711,8 +711,8 @@ try It 'Should throw if CertificateThumbprint and CertificateSubject are not specifed' { $altTestParameters = $testParameters.Clone() $altTestParameters.Remove('CertificateThumbPrint') - - {$result = Set-TargetResource @altTestParameters} | Should Throw + + {$result = Set-TargetResource @altTestParameters} | Should Throw } } } @@ -775,7 +775,7 @@ try It 'Should return $true when dbProvider is set to ESENT and ConnectionString does not match the value in web.config' { $DatabasePath = 'TestDrive:\DatabasePath' - + Mock -CommandName Get-WebConfigAppSetting -MockWith {'ESENT'} -Verifiable Mock -CommandName Test-WebConfigAppSetting -MockWith {param ($ExpectedAppSettingValue) Write-Verbose -Message 'Test-WebConfigAppSetting - dbconnectionstr (ESENT)'; ('{0}\Devices.edb' -f $DatabasePath) -eq $ExpectedAppSettingValue} -ParameterFilter {$AppSettingName -eq 'dbconnectionstr'} -Verifiable @@ -793,7 +793,7 @@ try } It 'Should return $true when dbProvider is set to System.Data.OleDb and ConnectionString does not match the value in web.config' { $DatabasePath = 'TestDrive:\DatabasePath' - + Mock -CommandName Get-WebConfigAppSetting -MockWith {'System.Data.OleDb'} -Verifiable Mock -CommandName Test-WebConfigAppSetting -MockWith {param ($ExpectedAppSettingValue) Write-Verbose -Message 'Test-WebConfigAppSetting - dbconnectionstr (OLE)'; ('Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}\Devices.mdb;' -f $DatabasePath) -eq $ExpectedAppSettingValue} -ParameterFilter {$AppSettingName -eq 'dbconnectionstr'} -Verifiable @@ -809,13 +809,13 @@ try Assert-VerifiableMock } - + Mock -CommandName Get-WebConfigAppSetting -MockWith {'ESENT'} -Verifiable Mock -CommandName Test-WebConfigAppSetting -MockWith {$true} -ParameterFilter {$AppSettingName -eq 'dbconnectionstr'} -Verifiable It 'Should return $true when ModulePath is set the same as in web.config' { $modulePath = 'TestDrive:\ModulePath' - + Mock -CommandName Test-WebConfigAppSetting -MockWith {param ($ExpectedAppSettingValue) Write-Verbose -Message 'Test-WebConfigAppSetting - ModulePath'; $modulePath -eq $ExpectedAppSettingValue} -ParameterFilter {$AppSettingName -eq 'ModulePath'} -Verifiable Test-TargetResource @testParameters -Ensure Present -ModulePath $modulePath | Should Be $true @@ -829,12 +829,12 @@ try Assert-VerifiableMock } - + Mock -CommandName Test-WebConfigAppSetting -MockWith {$true} -ParameterFilter {$AppSettingName -eq 'ModulePath'} -Verifiable It 'Should return $true when ConfigurationPath is set the same as in web.config' { $configurationPath = 'TestDrive:\ConfigurationPath' - + Mock -CommandName Test-WebConfigAppSetting -MockWith {param ($ExpectedAppSettingValue) Write-Verbose -Message 'Test-WebConfigAppSetting - ConfigurationPath'; $configurationPath -eq $ExpectedAppSettingValue} -ParameterFilter {$AppSettingName -eq 'ConfigurationPath'} -Verifiable Test-TargetResource @testParameters -Ensure Present -ConfigurationPath $configurationPath | Should Be $true @@ -843,19 +843,19 @@ try } It 'Should return $false when ConfigurationPath is not set the same as in web.config' { $configurationPath = 'TestDrive:\ConfigurationPath' - + Mock -CommandName Test-WebConfigAppSetting -MockWith {Write-Verbose -Message 'Test-WebConfigAppSetting - ConfigurationPath'; $false} -ParameterFilter {$AppSettingName -eq 'ConfigurationPath'} -Verifiable Test-TargetResource @testParameters -Ensure Present -ConfigurationPath $configurationPath | Should Be $false Assert-VerifiableMock } - + Mock -CommandName Test-WebConfigAppSetting -MockWith {$true} -ParameterFilter {$AppSettingName -eq 'ConfigurationPath'} -Verifiable It 'Should return $true when RegistrationKeyPath is set the same as in web.config' { $registrationKeyPath = 'TestDrive:\RegistrationKeyPath' - + Mock -CommandName Test-WebConfigAppSetting -MockWith {param ($ExpectedAppSettingValue) Write-Verbose -Message 'Test-WebConfigAppSetting - RegistrationKeyPath'; $registrationKeyPath -eq $ExpectedAppSettingValue} -ParameterFilter {$AppSettingName -eq 'RegistrationKeyPath'} -Verifiable Test-TargetResource @testParameters -Ensure Present -RegistrationKeyPath $registrationKeyPath | Should Be $true @@ -864,7 +864,7 @@ try } It 'Should return $false when RegistrationKeyPath is not set the same as in web.config' { $registrationKeyPath = 'TestDrive:\RegistrationKeyPath' - + Mock -CommandName Test-WebConfigAppSetting -MockWith {Write-Verbose -Message 'Test-WebConfigAppSetting - RegistrationKeyPath'; $false} -ParameterFilter {$AppSettingName -eq 'RegistrationKeyPath'} -Verifiable Test-TargetResource @testParameters -Ensure Present -RegistrationKeyPath $registrationKeyPath | Should Be $false @@ -873,7 +873,7 @@ try } It 'Should return $true when AcceptSelfSignedCertificates is set the same as in web.config' { $acceptSelfSignedCertificates = $true - + Mock -CommandName Test-WebConfigModulesSetting -MockWith {param ($ExpectedInstallationStatus) Write-Verbose -Message 'Test-WebConfigAppSetting - IISSelfSignedCertModule'; $acceptSelfSignedCertificates -eq $ExpectedInstallationStatus} -ParameterFilter {$ModuleName -eq 'IISSelfSignedCertModule(32bit)'} -Verifiable Test-TargetResource @testParameters -Ensure Present -AcceptSelfSignedCertificates $acceptSelfSignedCertificates | Should Be $true @@ -899,7 +899,7 @@ try It 'Should return $false if Certificate Thumbprint is set to AllowUnencryptedTraffic' { Test-TargetResource @testParameters -Ensure Present | Should Be $false } - + It 'Should return $false if Certificate Subject does not match the current certificate' { $altTestParameters = $testParameters.Clone() $altTestParameters.Remove('CertificateThumbprint') @@ -908,7 +908,7 @@ try Test-TargetResource @altTestParameters -Ensure Present -CertificateSubject 'Invalid Certifcate' | Should Be $false } - + Mock -CommandName Test-WebsitePath -MockWith {$false} -Verifiable It 'Should return $false when UseSecurityBestPractices and insecure protocols are enabled' { @@ -925,15 +925,15 @@ try Assert-VerifiableMock } - + } - + Context -Name 'Function parameters contain invalid data' -Fixture { It 'Should throw if CertificateThumbprint and CertificateSubject are not specifed' { $altTestParameters = $testParameters.Clone() $altTestParameters.Remove('CertificateThumbPrint') - - {$result = Test-TargetResource @altTestParameters} | Should Throw + + {$result = Test-TargetResource @altTestParameters} | Should Throw } } } diff --git a/Tests/Unit/MSFT_xEnvironmentResource.Tests.ps1 b/Tests/Unit/MSFT_xEnvironmentResource.Tests.ps1 index 413d94d57..c605e463a 100644 --- a/Tests/Unit/MSFT_xEnvironmentResource.Tests.ps1 +++ b/Tests/Unit/MSFT_xEnvironmentResource.Tests.ps1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import CommonTestHelper for Enter-DscResourceTestEnvironment, Exit-DscResourceTestEnvironment @@ -87,7 +87,7 @@ try It 'Should return the environment variable Ensure state as Absent' { $getTargetResourceResult.Ensure | Should Be 'Absent' } - + It 'Should return Value as null' { $getTargetResourceResult.Value | Should Be $null } @@ -135,7 +135,7 @@ try It 'Should return the environment variable Ensure state as Absent' { $getTargetResourceResult.Ensure | Should Be 'Absent' } - + It 'Should return Value as null' { $getTargetResourceResult.Value | Should Be $null } @@ -183,7 +183,7 @@ try It 'Should return the environment variable Ensure state as Absent' { $getTargetResourceResult.Ensure | Should Be 'Absent' } - + It 'Should return Value as null' { $getTargetResourceResult.Value | Should Be $null } @@ -205,7 +205,7 @@ try It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue } | Should Not Throw } - + It 'Should have set the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $newPathValue } @@ -219,11 +219,11 @@ try Context 'Add new environment variable with Path and item properties present' { $newPathValue = 'new path value2' - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Path $true } | Should Not Throw } - + It 'Should have set the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $newPathValue } @@ -268,7 +268,7 @@ try It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue } | Should Not Throw } - + It 'Should not have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $newPathValue } @@ -286,7 +286,7 @@ try It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue } | Should Not Throw } - + It 'Should have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $newPathValue } @@ -300,11 +300,11 @@ try Context 'Update environment variable with Path and invalid Value (;) passed in' { $newPathValue = ';' - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Path $true } | Should Not Throw } - + It 'Should not have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Not Be $newPathValue } @@ -320,11 +320,11 @@ try Context 'Update environment variable with Path and invalid Value ( ) passed in' { $newPathValue = ' ' - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Path $true } | Should Not Throw } - + It 'Should not have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Not Be $newPathValue } @@ -346,7 +346,7 @@ try It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Path $true } | Should Not Throw } - + It 'Should have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $newFullPathValue } @@ -366,11 +366,11 @@ try $oldPathValue = $script:mockEnvironmentVar.PATH $newPathValue = 'new path value 5' $newFullPathValue = ($script:mockEnvironmentVar.PATH +';' + $newPathValue) - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $oldPathValue -Path $true } | Should Not Throw } - + It 'Should not have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $oldPathValue } @@ -422,7 +422,7 @@ try { Set-TargetResource -Name $script:mockEnvironmentVarName ` -Value 'mockNewValue' ` -Ensure 'Absent' ` - -Path $false + -Path $false } | Should Not Throw } @@ -473,7 +473,7 @@ try Context 'Remove environment variable with Value set to full path value that the environment var is already set to' { $pathToRemove = $script:mockEnvironmentVar.PATH - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName ` -Value $pathToRemove ` @@ -496,7 +496,7 @@ try Context 'Remove environment variable with Value set to a path value that the environment variable contains' { $script:mockEnvironmentVar.PATH = 'path1;path2;path3;path4' $pathToRemove = 'path3' - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName ` -Value $pathToRemove ` @@ -529,7 +529,7 @@ try It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Target @('Process') } | Should Not Throw } - + It 'Should have set the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $newPathValue } @@ -543,11 +543,11 @@ try Context 'Add new environment variable with Path and item properties present' { $newPathValue = 'new path value2' - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Path $true -Target @('Process') } | Should Not Throw } - + It 'Should have set the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $newPathValue } @@ -585,11 +585,11 @@ try Context 'Update environment variable without Path and Value given is the value already set' { $newPathValue = 'new path value2' $script:mockEnvironmentVar.PATH = $newPathValue - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Target @('Process') } | Should Not Throw } - + It 'Should not have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $newPathValue } @@ -603,11 +603,11 @@ try Context 'Update environment variable without Path and new Value passed in' { $newPathValue = 'new path value3' - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Target @('Process') } | Should Not Throw } - + It 'Should have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $newPathValue } @@ -621,11 +621,11 @@ try Context 'Update environment variable with Path and invalid Value (;) passed in' { $newPathValue = ';' - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Path $true -Target @('Process') } | Should Not Throw } - + It 'Should not have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Not Be $newPathValue } @@ -640,11 +640,11 @@ try Context 'Update environment variable with Path and invalid Value ( ) passed in' { $newPathValue = ' ' - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Path $true -Target @('Process') } | Should Not Throw } - + It 'Should not have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Not Be $newPathValue } @@ -665,7 +665,7 @@ try It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Path $true -Target @('Process') } | Should Not Throw } - + It 'Should have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $newFullPathValue } @@ -684,11 +684,11 @@ try $oldPathValue = $script:mockEnvironmentVar.PATH $newPathValue = 'new path value 5' $newFullPathValue = ($script:mockEnvironmentVar.PATH +';' + $newPathValue) - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $oldPathValue -Path $true -Target @('Process') } | Should Not Throw } - + It 'Should not have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $oldPathValue } @@ -736,7 +736,7 @@ try -Value 'mockNewValue' ` -Ensure 'Absent' ` -Path $false ` - -Target @('Process') + -Target @('Process') } | Should Not Throw } @@ -787,7 +787,7 @@ try Context 'Remove environment variable with Value set to full path value that the environment var is already set to' { $pathToRemove = $script:mockEnvironmentVar.PATH - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName ` -Value $pathToRemove ` @@ -810,7 +810,7 @@ try Context 'Remove environment variable with Value set to a path value that the environment variable contains' { $script:mockEnvironmentVar.PATH = 'path1;path2;path3;path4' $pathToRemove = 'path3' - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName ` -Value $pathToRemove ` @@ -845,7 +845,7 @@ try It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Target @('Machine') } | Should Not Throw } - + It 'Should have set the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $newPathValue } @@ -859,11 +859,11 @@ try Context 'Add new environment variable with Path and item properties present' { $newPathValue = 'new path value2' - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Path $true -Target @('Machine') } | Should Not Throw } - + It 'Should have set the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $newPathValue } @@ -906,11 +906,11 @@ try Context 'Update environment variable without Path and Value given is the value already set' { $newPathValue = 'new path value2' $script:mockEnvironmentVar.PATH = $newPathValue - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Target @('Machine') } | Should Not Throw } - + It 'Should not have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $newPathValue } @@ -924,11 +924,11 @@ try Context 'Update environment variable without Path and new Value passed in' { $newPathValue = 'new path value3' - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Target @('Machine') } | Should Not Throw } - + It 'Should have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $newPathValue } @@ -942,11 +942,11 @@ try Context 'Update environment variable with Path and invalid Value (;) passed in' { $newPathValue = ';' - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Path $true -Target @('Machine') } | Should Not Throw } - + It 'Should not have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Not Be $newPathValue } @@ -962,11 +962,11 @@ try Context 'Update environment variable with Path and invalid Value ( ) passed in' { $newPathValue = ' ' - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Path $true -Target @('Machine') } | Should Not Throw } - + It 'Should not have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Not Be $newPathValue } @@ -988,7 +988,7 @@ try It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $newPathValue -Path $true -Target @('Machine') } | Should Not Throw } - + It 'Should have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $newFullPathValue } @@ -1008,11 +1008,11 @@ try $oldPathValue = $script:mockEnvironmentVar.PATH $newPathValue = 'new path value 5' $newFullPathValue = ($script:mockEnvironmentVar.PATH +';' + $newPathValue) - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Value $oldPathValue -Path $true -Target @('Machine') } | Should Not Throw } - + It 'Should not have updated the mock variable value' { $script:mockEnvironmentVar.PATH | Should Be $oldPathValue } @@ -1046,7 +1046,7 @@ try Mock -CommandName Get-EnvironmentVariableWithoutExpanding -MockWith { return $script:mockEnvironmentVar } Mock -CommandName Get-EnvironmentVariable -MockWith { return $script:mockEnvironmentVar.PATH } Mock -CommandName Remove-EnvironmentVariable -MockWith {} - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName -Ensure 'Absent' -Path $true -Target @('Machine') } | Should Not Throw } @@ -1145,7 +1145,7 @@ try Context 'Remove environment variable with Value set to a path value that the environment variable contains' { $script:mockEnvironmentVar.PATH = 'path1;path2;path3;path4' $pathToRemove = 'path3' - + It 'Should not throw an exception' { { Set-TargetResource -Name $script:mockEnvironmentVarName ` -Value $pathToRemove ` @@ -1307,7 +1307,7 @@ try Assert-MockCalled Test-PathsInValue -Exactly 1 -Scope Context } } - + $expectedProperties = @{ PATH = $expectedValue } Mock -CommandName Get-EnvironmentVariableWithoutExpanding -MockWith { return $expectedProperties } Mock -CommandName Get-EnvironmentVariable -MockWith { return $script:mockEnvironmentVar.PATH } @@ -1347,7 +1347,7 @@ try Assert-MockCalled Test-PathsInValue -Exactly 0 -Scope Context } } - + Mock -CommandName Get-EnvironmentVariableWithoutExpanding -MockWith { return $script:mockEnvironmentVar } Mock -CommandName Get-EnvironmentVariable -MockWith { return $script:mockEnvironmentVar.PATH } @@ -1365,7 +1365,7 @@ try Assert-MockCalled Test-PathsInValue -Exactly 0 -Scope Context } } - + Context 'Ensure set to Absent and Path set to false with non-existent value' { $expectedValue = 'nonExistentExpectedValue' @@ -1619,7 +1619,7 @@ try Assert-MockCalled Test-PathsInValue -Exactly 1 -Scope Context } } - + Mock -CommandName Get-EnvironmentVariable -MockWith { return $script:mockEnvironmentVar.PATH } Context 'Ensure set to Present, Path set to true, and not all paths in Value are set in process' { @@ -1654,7 +1654,7 @@ try Assert-MockCalled Test-PathsInValue -Exactly 0 -Scope Context } } - + Mock -CommandName Get-EnvironmentVariable -MockWith { return $script:mockEnvironmentVar.PATH } Context 'Ensure set to Absent and value not specified' { @@ -1671,7 +1671,7 @@ try Assert-MockCalled Test-PathsInValue -Exactly 0 -Scope Context } } - + Context 'Ensure set to Absent and Path set to false with non-existent value' { $expectedValue = 'nonExistentExpectedValue' @@ -1724,7 +1724,7 @@ try Context 'Ensure set to Absent, Path set to true, and Value is set in machine environment variable' { $script:mockEnvironmentVar.PATH = 'path1;path2;path3;path4' - + It 'Should return true' { $testTargetResourceResult = Test-TargetResource -Name $script:mockEnvironmentVarName ` -Value $expectedValue ` @@ -1736,7 +1736,7 @@ try It 'Should have called the correct mocks' { Assert-MockCalled Get-EnvironmentVariable -Exactly 1 -Scope Context - Assert-MockCalled Test-PathsInValue -Exactly 1 -Scope Context + Assert-MockCalled Test-PathsInValue -Exactly 1 -Scope Context } } @@ -1933,7 +1933,7 @@ try Assert-MockCalled Test-PathsInValue -Exactly 1 -Scope Context } } - + $expectedProperties = @{ PATH = $expectedValue } Mock -CommandName Get-EnvironmentVariableWithoutExpanding -MockWith { return $expectedProperties } Mock -CommandName Get-EnvironmentVariable -MockWith { return $script:mockEnvironmentVar.PATH } @@ -1974,7 +1974,7 @@ try Assert-MockCalled Test-PathsInValue -Exactly 0 -Scope Context } } - + Mock -CommandName Get-EnvironmentVariableWithoutExpanding -MockWith { return $script:mockEnvironmentVar } Context 'Ensure set to Absent and value not specified' { @@ -1992,7 +1992,7 @@ try Assert-MockCalled Test-PathsInValue -Exactly 0 -Scope Context } } - + Context 'Ensure set to Absent and Path set to false with non-existent value' { $expectedValue = 'nonExistentExpectedValue' @@ -2060,7 +2060,7 @@ try It 'Should have called the correct mocks' { Assert-MockCalled Get-EnvironmentVariableWithoutExpanding -Exactly 1 -Scope Context Assert-MockCalled Get-EnvironmentVariable -Exactly 0 -Scope Context - Assert-MockCalled Test-PathsInValue -Exactly 1 -Scope Context + Assert-MockCalled Test-PathsInValue -Exactly 1 -Scope Context } } @@ -2175,7 +2175,7 @@ try } } } - + Describe 'xEnvironmentResource\Remove-PathsFromValue' { Context 'Path is updated' { It 'Should return the updated path value with the specified path removed' { @@ -2210,17 +2210,17 @@ try Mock -CommandName Set-ProcessEnvironmentVariable -MockWith {} Mock -CommandName Set-ItemProperty -MockWith {} Mock -CommandName Remove-ItemProperty -MockWith {} - Mock -CommandName Get-ItemProperty -MockWith { + Mock -CommandName Get-ItemProperty -MockWith { if ($Name -eq $script:mockEnvironmentVarName) { return $script:mockEnvironmentVar.$script:mockEnvironmentVarName - } + } else { return $null } } - + Context 'Set Process variable' { It 'Should call the correct mocks' { Set-EnvironmentVariable -Name $script:mockEnvironmentVarName -Target @('Process') @@ -2260,19 +2260,19 @@ try } | Should Throw $script:localizedData.ArgumentTooLong } - + It 'Should throw exception when environment variable cannot be found to remove' { $invalidName = 'invalidName' { - Set-EnvironmentVariable -Name $invalidName -Target @('Machine') + Set-EnvironmentVariable -Name $invalidName -Target @('Machine') } | Should Throw ($script:localizedData.RemoveNonExistentVarError -f $invalidName) } It 'Should throw exception when environment variable cannot be found to set' { $invalidName = 'invalidName' { - Set-EnvironmentVariable -Name $invalidName -Value 'testValue' -Target @('Machine') + Set-EnvironmentVariable -Name $invalidName -Value 'testValue' -Target @('Machine') } | Should Throw ($script:localizedData.GetItemPropertyFailure -f $invalidName, $script:envVarRegPathMachine) } @@ -2298,13 +2298,13 @@ try It 'Should throw exception' { $name = 'mockVariableName' $value = 'mockValue' - { + { Set-EnvironmentVariable -Name $name -Value $value -Target @('Process') } | Should Throw $errorRecord } } } - + Describe 'xEnvironmentResource\Test-PathsInValue' { $existingPaths = 'path1;path2;path3;path5;path6' diff --git a/Tests/Unit/MSFT_xMsiPackage.Tests.ps1 b/Tests/Unit/MSFT_xMsiPackage.Tests.ps1 index 4145a75e5..28729fc10 100644 --- a/Tests/Unit/MSFT_xMsiPackage.Tests.ps1 +++ b/Tests/Unit/MSFT_xMsiPackage.Tests.ps1 @@ -1,4 +1,4 @@ -$errorActionPreference = 'Stop' +$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' Describe 'xMsiPackage Unit Tests' { @@ -121,7 +121,7 @@ Describe 'xMsiPackage Unit Tests' { -ExpectedReturnValue $expectedReturnValue } } - + Describe 'Set-TargetResource' { $setTargetResourceParameters = @{ ProductId = 'TestProductId' @@ -136,7 +136,7 @@ Describe 'xMsiPackage Unit Tests' { ServerCertificateValidationCallback = 'TestValidationCallback' RunAsCredential = $script:testCredential } - + Mock -CommandName 'Convert-PathToUri' -MockWith { return $script:testUriNonUnc } Mock -CommandName 'Convert-ProductIdToIdentifyingNumber' -MockWith { return $script:testIdentifyingNumber } Mock -CommandName 'Assert-PathExtensionValid' -MockWith {} @@ -156,7 +156,7 @@ Describe 'xMsiPackage Unit Tests' { Mock -CommandName 'Invoke-CimMethod' -MockWith {} Mock -CommandName 'Get-ItemProperty' -MockWith { return $null } Mock -CommandName 'Get-ProductEntry' -MockWith { return $script:mockProductEntry } - + Context 'Uri scheme is non-UNC file and installation succeeds' { $mocksCalled = @( @{ Command = 'Convert-PathToUri'; Times = 1 } @@ -347,7 +347,7 @@ Describe 'xMsiPackage Unit Tests' { -ErrorMessage ($script:localizedData.PostValidationError -f $setTargetResourceParameters.Path) ` -ErrorTestName $script:errorMessageTitles.PostValidationError } - + Mock -CommandName 'Get-MsiProductCode' -MockWith { return $script:testWrongProductId } Context 'Product code from downloaded MSI package does not match specified ID' { @@ -489,7 +489,7 @@ Describe 'xMsiPackage Unit Tests' { Convert-PathToUri -Path $filePath | Should Be $expectedReturnValue } - + It 'Should return the expected URI when scheme is http' { $filePath = 'http://localhost:1242/testMsi.msi' $expectedReturnValue = [Uri] $filePath @@ -684,7 +684,7 @@ Describe 'xMsiPackage Unit Tests' { -ErrorTestName $script:errorMessageTitles.CouldNotOpenLog } } - + Describe 'Get-WebRequestResponse' { Mock -CommandName 'Get-WebRequest' -MockWith { return $script:mockWebRequest } Mock -CommandName 'Get-ScriptBlock' -MockWith { return { Write-Verbose 'Hello World' } } @@ -700,7 +700,7 @@ Describe 'xMsiPackage Unit Tests' { It 'Should return the expected response stream' { Get-WebRequestResponse -Uri $script:testUriHttp | Should Be $script:mockStream } - + Invoke-ExpectedMocksAreCalledTest -MocksCalled $mocksCalled } @@ -714,7 +714,7 @@ Describe 'xMsiPackage Unit Tests' { It 'Should return the expected response stream' { Get-WebRequestResponse -Uri $script:testUriHttps | Should Be $script:mockStream } - + Invoke-ExpectedMocksAreCalledTest -MocksCalled $mocksCalled } @@ -857,7 +857,7 @@ Describe 'xMsiPackage Unit Tests' { Describe 'Assert-FileSignatureValid' { $mockThumbprint = 'mockThumbprint' $mockSubject = 'mockSubject' - $mockSignature = @{ + $mockSignature = @{ Status = [System.Management.Automation.SignatureStatus]::Valid SignerCertificate = @{ Thumbprint = $mockThumbprint; Subject = $mockSubject } } diff --git a/Tests/Unit/MSFT_xUserResource.TestHelper.psm1 b/Tests/Unit/MSFT_xUserResource.TestHelper.psm1 index 1ed7d5a3d..a6873c32c 100644 --- a/Tests/Unit/MSFT_xUserResource.TestHelper.psm1 +++ b/Tests/Unit/MSFT_xUserResource.TestHelper.psm1 @@ -1,4 +1,4 @@ -Import-Module "$PSScriptRoot\..\..\DSCResources\CommonResourceHelper.psm1" -Force +Import-Module "$PSScriptRoot\..\..\DSCResources\CommonResourceHelper.psm1" -Force <# .SYNOPSIS diff --git a/Tests/Unit/MSFT_xWindowsPackageCab.Tests.ps1 b/Tests/Unit/MSFT_xWindowsPackageCab.Tests.ps1 index 31e526c38..1284b7d39 100644 --- a/Tests/Unit/MSFT_xWindowsPackageCab.Tests.ps1 +++ b/Tests/Unit/MSFT_xWindowsPackageCab.Tests.ps1 @@ -1,4 +1,4 @@ -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath 'CommonTestHelper.psm1') +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath 'CommonTestHelper.psm1') $script:testEnvironment = Enter-DscResourceTestEnvironment ` -DscResourceModuleName 'xPSDesiredStateConfiguration' ` @@ -30,7 +30,7 @@ try It 'Should return Ensure as Absent when package is not installed' { $getTargetResourceResult = Get-TargetResource -Name $script:testPackageName @getTargetResourceCommonParams $getTargetResourceResult.Ensure | Should Be 'Absent' - + Assert-MockCalled -CommandName 'Dism\Get-WindowsPackage' } @@ -39,16 +39,16 @@ try $getTargetResourceResult = Get-TargetResource -Name $script:testPackageName @getTargetResourceCommonParams $getTargetResourceResult.Ensure | Should Be 'Absent' - + Assert-MockCalled -CommandName 'Dism\Get-WindowsPackage' } - + It 'Should return Ensure as Present when package is installed' { Mock -CommandName 'Dism\Get-WindowsPackage' -MockWith { return @{ PackageState = 'Installed' } } $getTargetResourceResult = Get-TargetResource -Name $script:testPackageName @getTargetResourceCommonParams $getTargetResourceResult.Ensure | Should Be 'Present' - + Assert-MockCalled -CommandName 'Dism\Get-WindowsPackage' } @@ -57,7 +57,7 @@ try $getTargetResourceResult = Get-TargetResource -Name $script:testPackageName @getTargetResourceCommonParams $getTargetResourceResult.Ensure | Should Be 'Present' - + Assert-MockCalled -CommandName 'Dism\Get-WindowsPackage' } @@ -116,10 +116,10 @@ try It 'Should return true when Get-TargetResource returns Ensure Present and Ensure is set to Present' { Test-TargetResource -Name $script:testPackageName -SourcePath $script:testSourcePath -Ensure 'Present' | Should Be $true Assert-MockCalled -CommandName 'Get-TargetResource' - } + } It 'Should return false when Get-TargetResource returns Ensure Present and Ensure is set to Absent' { - Test-TargetResource -Name $script:testPackageName -SourcePath $script:testSourcePath -Ensure 'Absent' | Should Be $false + Test-TargetResource -Name $script:testPackageName -SourcePath $script:testSourcePath -Ensure 'Absent' | Should Be $false Assert-MockCalled -CommandName 'Get-TargetResource' } diff --git a/Tests/Unit/ResourceSetHelper.Tests.ps1 b/Tests/Unit/ResourceSetHelper.Tests.ps1 index 719e19cf8..2e5c8ffc0 100644 --- a/Tests/Unit/ResourceSetHelper.Tests.ps1 +++ b/Tests/Unit/ResourceSetHelper.Tests.ps1 @@ -1,4 +1,4 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] param () $errorActionPreference = 'Stop' @@ -17,7 +17,7 @@ InModuleScope 'ResourceSetHelper' { Name = 'Name' CommonStringParameter1 = 'CommonParameter1' } - + $keyParameterName = 'Name' $commonParameterString = New-ResourceSetCommonParameterString -KeyParameterName $keyParameterName -Parameters $parameters @@ -27,12 +27,12 @@ InModuleScope 'ResourceSetHelper' { It 'Should return string containing one variable reference for one credential common parameter' { $testUserName = 'testUserName' $secureTestPassword = ConvertTo-SecureString -String 'testPassword' -AsPlainText -Force - + $parameters = @{ Name = 'Name' CommonCredentialParameter1 = New-Object -TypeName 'PSCredential' -ArgumentList @( $testUsername, $secureTestPassword ) } - + $keyParameterName = 'Name' $commonParameterString = New-ResourceSetCommonParameterString -KeyParameterName $keyParameterName -Parameters $parameters @@ -100,7 +100,7 @@ InModuleScope 'ResourceSetHelper' { CommonParameter2 = 'CommonParameterValue2' } } - + $newResourceSetConfigurationScriptBlock = New-ResourceSetConfigurationScriptBlock @newResourceSetConfigurationParams It 'Should return a ScriptBlock' { diff --git a/Tests/WindowsProcessTestProcess.cs b/Tests/WindowsProcessTestProcess.cs index ceb28b52e..d3050f79c 100644 --- a/Tests/WindowsProcessTestProcess.cs +++ b/Tests/WindowsProcessTestProcess.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Threading; // This is a test process used for testing configuring running and stopping a process on a machine diff --git a/appveyor.yml b/appveyor.yml index 25be927d5..880c069a5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,7 +25,8 @@ test_script: -Type 'Default' ` -CodeCoverage ` -CodeCovIo ` - -DisableConsistency + -DisableConsistency ` + -ExcludeTag @() #---------------------------------# # deployment configuration # From d4e778b6bf5447dcd2fee68974b141a44d3e3f6b Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Thu, 21 Jun 2018 11:46:00 +0200 Subject: [PATCH 4/9] Opt-in for the common test for example validation (#428) - Changes to xPSDesiredStateConfiguration - Opt-in for the common test for example validation. - Added Visual Studio Code workspace settings that helps with formatting against the style guideline. - Update all examples for them to be able pass the common test validation. --- .MetaTestOptIn.json | 3 +- .vscode/settings.json | 13 ++ ...ample_InstallExeCredsRegistry_xPackage.ps1 | 116 ++++++------ Examples/Sample_InstallExeCreds_xPackage.ps1 | 92 +++++---- .../Sample_InstallMSIProductId_xPackage.ps1 | 50 ++--- Examples/Sample_InstallMSI_xPackage.ps1 | 44 ++--- ...xArchive_ExpandArchiveChecksumAndForce.ps1 | 10 +- ...ExpandArchiveDefaultValidationAndForce.ps1 | 8 +- ...ple_xArchive_ExpandArchiveNoValidation.ps1 | 8 +- ...ve_ExpandArchiveNoValidationCredential.ps1 | 6 +- .../Sample_xArchive_RemoveArchiveChecksum.ps1 | 8 +- ...ple_xArchive_RemoveArchiveNoValidation.ps1 | 4 +- .../Sample_xDscWebServiceRegistration.ps1 | 51 ++--- ...eRegistrationWithSecurityBestPractices.ps1 | 80 +++++--- ...cWebServiceRegistration_UseSQLProvider.ps1 | 179 +++++------------- ...ebServiceRegistration_Win2k12and2k12R2.ps1 | 124 ++++-------- Examples/Sample_xDscWebServiceRemoval.ps1 | 17 +- ...nvironment_CreateMultiplePathVariables.ps1 | 10 +- ...ple_xEnvironment_CreateNonPathVariable.ps1 | 10 +- ...Sample_xEnvironment_CreatePathVariable.ps1 | 10 +- Examples/Sample_xEnvironment_Remove.ps1 | 8 +- ...ample_xEnvironment_RemovePathVariables.ps1 | 12 +- Examples/Sample_xFileUpload.ps1 | 43 +++-- Examples/Sample_xGroupSet_AddMembers.ps1 | 7 +- Examples/Sample_xGroup_RemoveMembers.ps1 | 7 +- Examples/Sample_xGroup_SetMembers.ps1 | 7 +- ...ple_xMsiPackage_InstallPackageFromFile.ps1 | 4 +- ...ple_xMsiPackage_InstallPackageFromHttp.ps1 | 4 +- ...e_xMsiPackage_UninstallPackageFromFile.ps1 | 4 +- ...xMsiPackage_UninstallPackageFromHttps.ps1} | 4 +- Examples/Sample_xPSSessionConfiguration.ps1 | 33 ++-- Examples/Sample_xProcessSet_Start.ps1 | 5 +- Examples/Sample_xProcessSet_Stop.ps1 | 7 +- Examples/Sample_xRegistryResource_AddKey.ps1 | 4 +- ...ple_xRegistryResource_AddOrModifyValue.ps1 | 6 +- .../Sample_xRegistryResource_RemoveKey.ps1 | 4 +- .../Sample_xRegistryResource_RemoveValue.ps1 | 4 +- Examples/Sample_xRemoteFile.ps1 | 29 ++- Examples/Sample_xRemoteFileUsingProxy.ps1 | 20 +- Examples/Sample_xScript.ps1 | 18 +- .../Sample_xServiceSet_BuiltInAccount.ps1 | 15 +- Examples/Sample_xServiceSet_StartServices.ps1 | 13 +- Examples/Sample_xService_CreateService.ps1 | 8 +- Examples/Sample_xService_DeleteService.ps1 | 6 +- ..._xService_UpdateStartupTypeIgnoreState.ps1 | 9 +- Examples/Sample_xUser_CreateUser.ps1 | 16 +- Examples/Sample_xUser_Generic.ps1 | 27 ++- Examples/Sample_xWindowsFeature.ps1 | 14 +- .../Sample_xWindowsFeatureSet_Install.ps1 | 18 +- .../Sample_xWindowsFeatureSet_Uninstall.ps1 | 18 +- Examples/Sample_xWindowsOptionalFeature.ps1 | 13 +- ...ple_xWindowsOptionalFeatureSet_Disable.ps1 | 2 +- ...mple_xWindowsOptionalFeatureSet_Enable.ps1 | 13 +- Examples/Sample_xWindowsPackageCab.ps1 | 15 +- Examples/Sample_xWindowsProcess_Start.ps1 | 10 +- .../Sample_xWindowsProcess_StartUnderUser.ps1 | 14 +- Examples/Sample_xWindowsProcess_Stop.ps1 | 12 +- .../Sample_xWindowsProcess_StopUnderUser.ps1 | 19 +- README.md | 4 + Tests/Unit/ResourceSetHelper.Tests.ps1 | 6 +- 60 files changed, 617 insertions(+), 708 deletions(-) create mode 100644 .vscode/settings.json rename Examples/{Sample_xMsiPackage_UnstallPackageFromHttps.ps1 => Sample_xMsiPackage_UninstallPackageFromHttps.ps1} (88%) diff --git a/.MetaTestOptIn.json b/.MetaTestOptIn.json index baa2a30d7..60106a20f 100644 --- a/.MetaTestOptIn.json +++ b/.MetaTestOptIn.json @@ -1,4 +1,5 @@ [ "Common Tests - Validate Module Files", - "Common Tests - Validate Script Files" + "Common Tests - Validate Script Files", + "Common Tests - Validate Example Files" ] diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..87c4308ca --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "powershell.codeFormatting.openBraceOnSameLine": false, + "powershell.codeFormatting.newLineAfterOpenBrace": false, + "powershell.codeFormatting.newLineAfterCloseBrace": true, + "powershell.codeFormatting.whitespaceBeforeOpenBrace": true, + "powershell.codeFormatting.whitespaceBeforeOpenParen": true, + "powershell.codeFormatting.whitespaceAroundOperator": true, + "powershell.codeFormatting.whitespaceAfterSeparator": true, + "powershell.codeFormatting.ignoreOneLineBlock": false, + "powershell.codeFormatting.preset": "Custom", + "files.trimTrailingWhitespace": true, + "files.insertFinalNewline": true +} diff --git a/Examples/Sample_InstallExeCredsRegistry_xPackage.ps1 b/Examples/Sample_InstallExeCredsRegistry_xPackage.ps1 index 321553d42..a0e13951c 100644 --- a/Examples/Sample_InstallExeCredsRegistry_xPackage.ps1 +++ b/Examples/Sample_InstallExeCredsRegistry_xPackage.ps1 @@ -1,82 +1,72 @@ -<# -Simple package that installs an .exe using credentials to access the installer and specifying RunAs Credentials. -This sample also uses custom registry data to discover the package. - +<# + Simple package that installs an .exe using credentials to access the installer and specifying RunAs Credentials. + This sample also uses custom registry data to discover the package. #> -param -( - [String]$OutputPath = ".", +Configuration Example +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] $Package, - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $Package, + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] $Source, - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $Source, + [parameter(Mandatory = $true)] + [ValidateNotNull()] + [String] $ProductId, - [parameter(Mandatory = $true)] - [ValidateNotNull()] - [String] $ProductId, - - [boolean] $CreateCheckRegValue = $false, + [boolean] $CreateCheckRegValue = $false, - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $InstalledCheckRegKey, + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] $InstalledCheckRegKey, - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $InstalledCheckRegValueName, + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] $InstalledCheckRegValueName, - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $InstalledCheckRegValueData, + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] $InstalledCheckRegValueData, - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [PSCredential] $Credential, + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [PSCredential] $Credential, - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [PSCredential] $RunAsCredential, + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [PSCredential] $RunAsCredential, - [parameter(Mandatory = $true)] - [ValidateNotNull()] - [PSCredential] $Arguments -) + [parameter(Mandatory = $true)] + [ValidateNotNull()] + [String] $Arguments + ) -Configuration Sample -{ - Import-DscResource -Module xPSDesiredStateConfiguration + Import-DscResource -ModuleName xPSDesiredStateConfiguration - xPackage t1 + Node localhost { - Ensure="Present" - Name = $Package - Path = $Source - Arguments = $Arguments - RunAsCredential = $RunAsCredential - Credential = $Credential - ProductId = $ProductId - CreateCheckRegValue = $CreateCheckRegValue - InstalledCheckRegKey = $InstalledCheckRegKey - InstalledCheckRegValueName = $InstalledCheckRegValueName - InstalledCheckRegValueData = $InstalledCheckRegValueData + xPackage t1 + { + Ensure = "Present" + Name = $Package + Path = $Source + Arguments = $Arguments + RunAsCredential = $RunAsCredential + Credential = $Credential + ProductId = $ProductId + CreateCheckRegValue = $CreateCheckRegValue + InstalledCheckRegKey = $InstalledCheckRegKey + InstalledCheckRegValueName = $InstalledCheckRegValueName + InstalledCheckRegValueData = $InstalledCheckRegValueData + } } } -$Global:AllNodes= -@{ - AllNodes = @( - @{ - NodeName = "localhost"; - RecurseValue = $true; - }; - ); -} - -<# +<# Sample use (parameter values need to be changed according to your scenario): The reg key and value is created by xPacakage. diff --git a/Examples/Sample_InstallExeCreds_xPackage.ps1 b/Examples/Sample_InstallExeCreds_xPackage.ps1 index 8c47d5091..5cd884e5e 100644 --- a/Examples/Sample_InstallExeCreds_xPackage.ps1 +++ b/Examples/Sample_InstallExeCreds_xPackage.ps1 @@ -1,60 +1,58 @@ -<# +<# Simple package that installs an .exe using credentials to access the installer and specifying RunAs Credentials. #> -param -( - [String]$OutputPath = ".", - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $PackageName, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $SourcePath, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $ProductId, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [PSCredential] $Credential, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [PSCredential] $RunAsCredential - -) - -Configuration Sample +Configuration Example { - Import-DscResource -Module xPSDesiredStateConfiguration - - xPackage t1 + param + ( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] + $PackageName, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] + $SourcePath, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] + $ProductId, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [PSCredential] + $Credential, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [PSCredential] + $RunAsCredential + ) + + + Import-DscResource -ModuleName xPSDesiredStateConfiguration + + Node localhost { - Ensure="Present" - Name = $PackageName - Path = $SourcePath - RunAsCredential = $RunAsCredential - Credential = $Credentials - ProductId = $ProductId + xPackage t1 + { + Ensure = "Present" + Name = $PackageName + Path = $SourcePath + RunAsCredential = $RunAsCredential + Credential = $Credential + ProductId = $ProductId + } } } -$Global:AllNodes= -@{ - AllNodes = @( - @{ - NodeName = "localhost"; - RecurseValue = $true; - }; - ); -} -<# + +<# Sample use (parameter values need to be changed according to your scenario): # Create the MOF file using the configuration data diff --git a/Examples/Sample_InstallMSIProductId_xPackage.ps1 b/Examples/Sample_InstallMSIProductId_xPackage.ps1 index 37ca774ce..652898747 100644 --- a/Examples/Sample_InstallMSIProductId_xPackage.ps1 +++ b/Examples/Sample_InstallMSIProductId_xPackage.ps1 @@ -1,38 +1,38 @@ -<# +<# Simple installer that installs an msi package and matches based on the product id. #> +Configuration Example +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] $PackageName, -param -( - [String]$OutputPath = ".", - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $PackageName, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $SourcePath, + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] $SourcePath, - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $ProductId -) + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] $ProductId + ) -Configuration Sample -{ - Import-DscResource -Module xPSDesiredStateConfiguration + Import-DscResource -ModuleName xPSDesiredStateConfiguration - xPackage t1 + Node localhost { - Ensure="Present" - Name = $PackageName - Path = $SourcePath - ProductId = $ProductId + xPackage t1 + { + Ensure = "Present" + Name = $PackageName + Path = $SourcePath + ProductId = $ProductId + } } } -<# +<# Sample use (parameter values need to be changed according to your scenario): # Create the MOF file using the configuration data diff --git a/Examples/Sample_InstallMSI_xPackage.ps1 b/Examples/Sample_InstallMSI_xPackage.ps1 index ea8dcbb56..1f4815752 100644 --- a/Examples/Sample_InstallMSI_xPackage.ps1 +++ b/Examples/Sample_InstallMSI_xPackage.ps1 @@ -1,34 +1,34 @@ -<# +<# Simple installer for an msi package that matches via the Name. #> +Configuration Example +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] $PackageName, -param -( - [String]$OutputPath = ".", - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $PackageName, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $SourcePath -) + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] $SourcePath + ) -Configuration Sample -{ - Import-DscResource -Module xPSDesiredStateConfiguration + Import-DscResource -ModuleName xPSDesiredStateConfiguration - xPackage t1 + Node localhost { - Ensure="Present" - Name = $PackageName - Path = $SourcePath - ProductId = "" + xPackage t1 + { + Ensure = "Present" + Name = $PackageName + Path = $SourcePath + ProductId = "" + } } } -<# +<# Sample use (parameter values need to be changed according to your scenario): # Create the MOF file using the configuration data diff --git a/Examples/Sample_xArchive_ExpandArchiveChecksumAndForce.ps1 b/Examples/Sample_xArchive_ExpandArchiveChecksumAndForce.ps1 index a4af5f326..d7efc7839 100644 --- a/Examples/Sample_xArchive_ExpandArchiveChecksumAndForce.ps1 +++ b/Examples/Sample_xArchive_ExpandArchiveChecksumAndForce.ps1 @@ -19,12 +19,12 @@ Configuration Sample_xArchive_ExpandArchiveChecksumAndForce { xArchive Archive4 { - Path = 'C:\ExampleArchivePath\Archive.zip' + Path = 'C:\ExampleArchivePath\Archive.zip' Destination = 'C:\ExampleDestinationPath\Destination' - Validate = $true - Checksum = 'SHA-256' - Force = $true - Ensure = 'Present' + Validate = $true + Checksum = 'SHA-256' + Force = $true + Ensure = 'Present' } } } diff --git a/Examples/Sample_xArchive_ExpandArchiveDefaultValidationAndForce.ps1 b/Examples/Sample_xArchive_ExpandArchiveDefaultValidationAndForce.ps1 index 186c8e1bc..ec13c4519 100644 --- a/Examples/Sample_xArchive_ExpandArchiveDefaultValidationAndForce.ps1 +++ b/Examples/Sample_xArchive_ExpandArchiveDefaultValidationAndForce.ps1 @@ -19,11 +19,11 @@ Configuration Sample_xArchive_ExpandArchiveDefaultValidationAndForce { xArchive Archive3 { - Path = 'C:\ExampleArchivePath\Archive.zip' + Path = 'C:\ExampleArchivePath\Archive.zip' Destination = 'C:\ExampleDestinationPath\Destination' - Validate = $true - Force = $true - Ensure = 'Present' + Validate = $true + Force = $true + Ensure = 'Present' } } } diff --git a/Examples/Sample_xArchive_ExpandArchiveNoValidation.ps1 b/Examples/Sample_xArchive_ExpandArchiveNoValidation.ps1 index a8f5631d3..5d6382b47 100644 --- a/Examples/Sample_xArchive_ExpandArchiveNoValidation.ps1 +++ b/Examples/Sample_xArchive_ExpandArchiveNoValidation.ps1 @@ -3,9 +3,9 @@ Expands the archive located at 'C:\ExampleArchivePath\Archive.zip' to the destination path 'C:\ExampleDestinationPath\Destination'. - The resource will only check if the expanded archive files exist at the destination. + The resource will only check if the expanded archive files exist at the destination. No validation is performed on any existing files at the destination to ensure that they - match the files in the archive. + match the files in the archive. #> Configuration Sample_xArchive_ExpandArchiveNoValidation { @@ -15,9 +15,9 @@ Configuration Sample_xArchive_ExpandArchiveNoValidation { xArchive Archive1 { - Path = 'C:\ExampleArchivePath\Archive.zip' + Path = 'C:\ExampleArchivePath\Archive.zip' Destination = 'C:\ExampleDestinationPath\Destination' - Ensure = 'Present' + Ensure = 'Present' } } } diff --git a/Examples/Sample_xArchive_ExpandArchiveNoValidationCredential.ps1 b/Examples/Sample_xArchive_ExpandArchiveNoValidationCredential.ps1 index 711947338..42a132f87 100644 --- a/Examples/Sample_xArchive_ExpandArchiveNoValidationCredential.ps1 +++ b/Examples/Sample_xArchive_ExpandArchiveNoValidationCredential.ps1 @@ -26,10 +26,10 @@ Configuration Sample_xArchive_ExpandArchiveNoValidationCredential { xArchive Archive2 { - Path = 'C:\ExampleArchivePath\Archive.zip' + Path = 'C:\ExampleArchivePath\Archive.zip' Destination = 'C:\ExampleDestinationPath\Destination' - Credential = $Credential - Ensure = 'Present' + Credential = $Credential + Ensure = 'Present' } } } diff --git a/Examples/Sample_xArchive_RemoveArchiveChecksum.ps1 b/Examples/Sample_xArchive_RemoveArchiveChecksum.ps1 index 591911d75..b92469c5f 100644 --- a/Examples/Sample_xArchive_RemoveArchiveChecksum.ps1 +++ b/Examples/Sample_xArchive_RemoveArchiveChecksum.ps1 @@ -15,11 +15,11 @@ Configuration Sample_xArchive_RemoveArchiveChecksum { xArchive Archive6 { - Path = 'C:\ExampleArchivePath\Archive.zip' + Path = 'C:\ExampleArchivePath\Archive.zip' Destination = 'C:\ExampleDestinationPath\Destination' - Validate = $true - Checksum = 'SHA-256' - Ensure = 'Absent' + Validate = $true + Checksum = 'SHA-256' + Ensure = 'Absent' } } } diff --git a/Examples/Sample_xArchive_RemoveArchiveNoValidation.ps1 b/Examples/Sample_xArchive_RemoveArchiveNoValidation.ps1 index 23922eb75..506b9f209 100644 --- a/Examples/Sample_xArchive_RemoveArchiveNoValidation.ps1 +++ b/Examples/Sample_xArchive_RemoveArchiveNoValidation.ps1 @@ -15,9 +15,9 @@ Configuration Sample_xArchive_RemoveArchiveNoValidation { xArchive Archive5 { - Path = 'C:\ExampleArchivePath\Archive.zip' + Path = 'C:\ExampleArchivePath\Archive.zip' Destination = 'C:\ExampleDestinationPath\Destination' - Ensure = 'Absent' + Ensure = 'Absent' } } } diff --git a/Examples/Sample_xDscWebServiceRegistration.ps1 b/Examples/Sample_xDscWebServiceRegistration.ps1 index eae5b0f95..1e3ef9905 100644 --- a/Examples/Sample_xDscWebServiceRegistration.ps1 +++ b/Examples/Sample_xDscWebServiceRegistration.ps1 @@ -14,16 +14,19 @@ # =================================== Section Pull Server =================================== # configuration Sample_xDscWebServiceRegistration { - param + param ( - [string[]]$NodeName = 'localhost', + [string[]] + $NodeName = 'localhost', [ValidateNotNullOrEmpty()] - [string] $certificateThumbPrint, + [string] + $certificateThumbPrint, - [Parameter(HelpMessage='This should be a string with enough entropy (randomness) to protect the registration of clients to the pull server. We will use new GUID by default.')] + [Parameter(HelpMessage = 'This should be a string with enough entropy (randomness) to protect the registration of clients to the pull server. We will use new GUID by default.')] [ValidateNotNullOrEmpty()] - [string] $RegistrationKey # A guid that clients use to initiate conversation with pull server + [string] + $RegistrationKey # A guid that clients use to initiate conversation with pull server ) Import-DSCResource -ModuleName xPSDesiredStateConfiguration @@ -33,23 +36,24 @@ configuration Sample_xDscWebServiceRegistration WindowsFeature DSCServiceFeature { Ensure = "Present" - Name = "DSC-Service" + Name = "DSC-Service" } xDscWebService PSDSCPullServer { - Ensure = "Present" - EndpointName = "PSDSCPullServer" - Port = 8080 - PhysicalPath = "$env:SystemDrive\inetpub\PSDSCPullServer" - CertificateThumbPrint = $certificateThumbPrint - ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules" - ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration" - State = "Started" - DependsOn = "[WindowsFeature]DSCServiceFeature" - RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService" + Ensure = "Present" + EndpointName = "PSDSCPullServer" + Port = 8080 + PhysicalPath = "$env:SystemDrive\inetpub\PSDSCPullServer" + CertificateThumbPrint = $certificateThumbPrint + ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules" + ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration" + State = "Started" + DependsOn = "[WindowsFeature]DSCServiceFeature" + RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService" AcceptSelfSignedCertificates = $true - Enable32BitAppOnWin64 = $false + Enable32BitAppOnWin64 = $false + UseSecurityBestPractices = $true } File RegistrationKeyFile @@ -76,20 +80,23 @@ configuration Sample_MetaConfigurationToRegisterWithLessSecurePullServer param ( [ValidateNotNullOrEmpty()] - [string] $NodeName = 'localhost', + [string] + $NodeName = 'localhost', [ValidateNotNullOrEmpty()] - [string] $RegistrationKey, #same as the one used to setup pull server in previous configuration + [string] + $RegistrationKey, #same as the one used to setup pull server in previous configuration [ValidateNotNullOrEmpty()] - [string] $ServerName = 'localhost' #node name of the pull server, same as $NodeName used in previous configuration + [string] + $ServerName = 'localhost' #node name of the pull server, same as $NodeName used in previous configuration ) Node $NodeName { Settings { - RefreshMode = 'Pull' + RefreshMode = 'Pull' } ConfigurationRepositoryWeb CONTOSO-PullSrv @@ -97,7 +104,7 @@ configuration Sample_MetaConfigurationToRegisterWithLessSecurePullServer ServerURL = "https://$ServerName`:8080/PSDSCPullServer.svc" # notice it is https RegistrationKey = $RegistrationKey ConfigurationNames = @('ClientConfig') - } + } ReportServerWeb CONTOSO-PullSrv { diff --git a/Examples/Sample_xDscWebServiceRegistrationWithSecurityBestPractices.ps1 b/Examples/Sample_xDscWebServiceRegistrationWithSecurityBestPractices.ps1 index ee230f52b..a6b86e799 100644 --- a/Examples/Sample_xDscWebServiceRegistrationWithSecurityBestPractices.ps1 +++ b/Examples/Sample_xDscWebServiceRegistrationWithSecurityBestPractices.ps1 @@ -11,49 +11,72 @@ # The Sample_MetaConfigurationToRegisterWithSecurePullServer register a DSC client node with the pull server # ======================================== Arguments ======================================== # -$thumbprint = (New-SelfSignedCertificate -Subject $env:COMPUTERNAME).Thumbprint -$registrationkey = [guid]::NewGuid() +<# + Check if OS major version is higher or equal to 10. + + Note: This check is to pass example validation CI tests, + it has not been tested to run on Windows Server 2012 R2, + please see the following example for a Windows Server 2012 R2 version + of this example; + https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/Examples/Sample_xDscWebServiceRegistration_Win2k12and2k12R2.ps1. +#> +if ([Environment]::OSVersion.Version.Major -ge '10') +{ + $thumbprint = (New-SelfSignedCertificate -Subject $env:COMPUTERNAME).Thumbprint +} +else +{ + Write-Warning -Message 'Running on operating system older than major version 10, this configuration is not meant to run on OS with a major version older than version 10. Generating certificate using New-SelfSignedCertificate with an alternate method.' + $thumbprint = (New-SelfSignedCertificate -DnsName $env:COMPUTERNAME -CertStoreLocation cert:\LocalMachine\My ).Thumbprint +} + +$registrationKey = [guid]::NewGuid() # ======================================== Arguments ======================================== # # =================================== Section DSC Client =================================== # configuration Sample_xDscWebServiceRegistrationWithSecurityBestPractices { - param + param ( - [string[]]$NodeName = 'localhost', + [string[]] + $NodeName = 'localhost', [ValidateNotNullOrEmpty()] - [string] $certificateThumbPrint, + [string] + $certificateThumbPrint, - [Parameter(HelpMessage='This should be a string with enough entropy (randomness) to protect the registration of clients to the pull server. We will use new GUID by default.')] + [Parameter(HelpMessage = 'This should be a string with enough entropy (randomness) to protect the registration of clients to the pull server. We will use new GUID by default.')] [ValidateNotNullOrEmpty()] - [string] $RegistrationKey # A guid that clients use to initiate conversation with pull server + [string] + $RegistrationKey # A guid that clients use to initiate conversation with pull server ) - + Import-DSCResource -ModuleName xPSDesiredStateConfiguration + # To explicitly import the resource WindowsFesture and File. + Import-DscResource -ModuleName PSDesiredStateConfiguration Node $NodeName { WindowsFeature DSCServiceFeature { Ensure = "Present" - Name = "DSC-Service" + Name = "DSC-Service" } xDscWebService PSDSCPullServer { - Ensure = "Present" - EndpointName = "PSDSCPullServer" - Port = 8080 - PhysicalPath = "$env:SystemDrive\inetpub\PSDSCPullServer" - CertificateThumbPrint = $certificateThumbPrint - ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules" - ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration" - State = "Started" - DependsOn = "[WindowsFeature]DSCServiceFeature" - RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService" + Ensure = "Present" + EndpointName = "PSDSCPullServer" + Port = 8080 + PhysicalPath = "$env:SystemDrive\inetpub\PSDSCPullServer" + CertificateThumbPrint = $certificateThumbPrint + ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules" + ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration" + State = "Started" + DependsOn = "[WindowsFeature]DSCServiceFeature" + RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService" AcceptSelfSignedCertificates = $true - UseSecurityBestPractices = $true + UseSecurityBestPractices = $true } File RegistrationKeyFile @@ -65,7 +88,7 @@ configuration Sample_xDscWebServiceRegistrationWithSecurityBestPractices } } } -Sample_xDscWebServiceRegistrationWithSecurityBestPractices -RegistrationKey $registrationkey -certificateThumbPrint $certificateThumbPrint +Sample_xDscWebServiceRegistrationWithSecurityBestPractices -RegistrationKey $registrationKey -certificateThumbPrint $thumbprint # =================================== Section Pull Server =================================== # # =================================== Section DSC Client =================================== # @@ -75,20 +98,23 @@ configuration Sample_MetaConfigurationToRegisterWithSecurePullServer param ( [ValidateNotNullOrEmpty()] - [string] $NodeName = 'localhost', + [string] + $NodeName = 'localhost', [ValidateNotNullOrEmpty()] - [string] $RegistrationKey, #same as the one used to setup pull server in previous configuration + [string] + $RegistrationKey, #same as the one used to setup pull server in previous configuration [ValidateNotNullOrEmpty()] - [string] $ServerName = 'localhost' #node name of the pull server, same as $NodeName used in previous configuration + [string] + $ServerName = 'localhost' #node name of the pull server, same as $NodeName used in previous configuration ) Node $NodeName { Settings { - RefreshMode = 'Pull' + RefreshMode = 'Pull' } ConfigurationRepositoryWeb CONTOSO-PullSrv @@ -96,7 +122,7 @@ configuration Sample_MetaConfigurationToRegisterWithSecurePullServer ServerURL = "https://$ServerName`:8080/PSDSCPullServer.svc" # notice it is https RegistrationKey = $RegistrationKey ConfigurationNames = @('ClientConfig') - } + } ReportServerWeb CONTOSO-PullSrv { @@ -106,5 +132,5 @@ configuration Sample_MetaConfigurationToRegisterWithSecurePullServer } } -Sample_MetaConfigurationToRegisterWithSecurePullServer -RegistrationKey $registrationkey +Sample_MetaConfigurationToRegisterWithSecurePullServer -RegistrationKey $registrationKey # =================================== Section DSC Client =================================== # diff --git a/Examples/Sample_xDscWebServiceRegistration_UseSQLProvider.ps1 b/Examples/Sample_xDscWebServiceRegistration_UseSQLProvider.ps1 index a22fd86ab..e56bce37a 100644 --- a/Examples/Sample_xDscWebServiceRegistration_UseSQLProvider.ps1 +++ b/Examples/Sample_xDscWebServiceRegistration_UseSQLProvider.ps1 @@ -1,222 +1,145 @@ # DSC configuration for Pull Server using registration with enhanced security settings - - # The Sample_xDscWebServiceRegistration_UseSQLProvider configuration sets up a DSC pull server that is capable for client nodes - # to register with it and use SQL Server as a backend DB - - # Prerequisite:1- Install a certificate in "CERT:\LocalMachine\MY\" store - # For testing environments, you could use a self-signed certificate. (New-SelfSignedCertificate cmdlet could generate one for you). - # For production environments, you will need a certificate signed by valid CA. - # Registration only works over https protocols. So to use registration feature, a secure pull server setup with certificate is necessary - # 2- Install and Configure SQL Server - # The Sample_MetaConfigurationToRegisterWithSecurePullServer register a DSC client node with the pull server - - # ======================================== Arguments ======================================== # -$thumbprint = (New-SelfSignedCertificate -Subject $env:COMPUTERNAME).Thumbprint - -$registrationkey = [guid]::NewGuid() +<# + Check if OS major version is higher or equal to 10. -# ======================================== Arguments ======================================== # + Note: This check is to pass example validation CI tests, + it has not been tested to run on Windows Server 2012 R2, + please see the following example for a Windows Server 2012 R2 version + of this example; + https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/Examples/Sample_xDscWebServiceRegistration_Win2k12and2k12R2.ps1. +#> +if ([Environment]::OSVersion.Version.Major -ge '10') +{ + $thumbprint = (New-SelfSignedCertificate -Subject $env:COMPUTERNAME).Thumbprint +} +else +{ + Write-Warning -Message 'Running on operating system older than major version 10, this configuration is not meant to run on OS with a major version older than version 10. Generating certificate using New-SelfSignedCertificate with an alternate method.' + $thumbprint = (New-SelfSignedCertificate -DnsName $env:COMPUTERNAME -CertStoreLocation cert:\LocalMachine\My ).Thumbprint +} +$registrationKey = [guid]::NewGuid() +# ======================================== Arguments ======================================== # -# =================================== Section DSC Client =================================== # +# =================================== Section Pull Server =================================== # configuration Sample_xDscWebServiceRegistration_UseSQLProvider - { - param - ( - - [string[]]$NodeName = 'localhost', - - + [string[]] + $NodeName = 'localhost', [ValidateNotNullOrEmpty()] + [string] + $CertificateThumbPrint, - [string] $certificateThumbPrint, - - - - [Parameter(HelpMessage='This should be a string with enough entropy (randomness) to protect the registration of clients to the pull server. We will use new GUID by default.')] - + [Parameter(HelpMessage = 'This should be a string with enough entropy (randomness) to protect the registration of clients to the pull server. We will use new GUID by default.')] [ValidateNotNullOrEmpty()] - - [string] $RegistrationKey # A guid that clients use to initiate conversation with pull server - + [string] + $RegistrationKey # A guid that clients use to initiate conversation with pull server ) - - Import-DSCResource -ModuleName xPSDesiredStateConfiguration + # To explicitly import the resource WindowsFesture and File. + Import-DscResource -ModuleName PSDesiredStateConfiguration Node $NodeName - { - WindowsFeature DSCServiceFeature - { - Ensure = "Present" - Name = "DSC-Service" - } - - xDscWebService PSDSCPullServer - { - - Ensure = "Present" - - EndpointName = "PSDSCPullServer" - - Port = 8080 - - PhysicalPath = "$env:SystemDrive\inetpub\PSDSCPullServer" - - CertificateThumbPrint = $certificateThumbPrint - - ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules" - - ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration" - - State = "Started" - - DependsOn = "[WindowsFeature]DSCServiceFeature" - - RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService" - + Ensure = "Present" + EndpointName = "PSDSCPullServer" + Port = 8080 + PhysicalPath = "$env:SystemDrive\inetpub\PSDSCPullServer" + CertificateThumbPrint = $certificateThumbPrint + ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules" + ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration" + State = "Started" + DependsOn = "[WindowsFeature]DSCServiceFeature" + RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService" AcceptSelfSignedCertificates = $true - - UseSecurityBestPractices = $true - - SqlProvider = $true - - SqlConnectionString = "Provider=SQLNCLI11;Data Source=(local)\SQLExpress;User ID=SA;Password=Password12!;Initial Catalog=master;" - + UseSecurityBestPractices = $true + SqlProvider = $true + SqlConnectionString = "Provider=SQLNCLI11;Data Source=(local)\SQLExpress;User ID=SA;Password=Password12!;Initial Catalog=master;" } - - File RegistrationKeyFile - { - Ensure = 'Present' - Type = 'File' - DestinationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\RegistrationKeys.txt" - Contents = $RegistrationKey - } - } - } -Sample_xDscWebServiceRegistration_UseSQLProvider -RegistrationKey $registrationkey -certificateThumbPrint $thumbprint -Verbose +Sample_xDscWebServiceRegistration_UseSQLProvider -RegistrationKey $registrationKey -CertificateThumbPrint $thumbprint -Verbose # =================================== Section Pull Server =================================== # - - - # =================================== Section DSC Client =================================== # [DSCLocalConfigurationManager()] - configuration Sample_MetaConfigurationToRegisterWithSecurePullServer - { - param - ( - [ValidateNotNullOrEmpty()] - - [string] $NodeName = 'localhost', - - + [string] + $NodeName = 'localhost', [ValidateNotNullOrEmpty()] - - [string] $RegistrationKey, #same as the one used to setup pull server in previous configuration - - + [string] + $RegistrationKey, #same as the one used to setup pull server in previous configuration [ValidateNotNullOrEmpty()] - - [string] $ServerName = 'localhost' #node name of the pull server, same as $NodeName used in previous configuration - + [string] + $ServerName = 'localhost' #node name of the pull server, same as $NodeName used in previous configuration ) - - Node $NodeName - { - Settings - { - - RefreshMode = 'Pull' - + RefreshMode = 'Pull' } - - ConfigurationRepositoryWeb CONTOSO-PullSrv - { - ServerURL = "https://$ServerName`:8080/PSDSCPullServer.svc" # notice it is https - RegistrationKey = $RegistrationKey - ConfigurationNames = @('ClientConfig') - } - - ReportServerWeb CONTOSO-PullSrv - { - ServerURL = "https://$ServerName`:8080/PSDSCPullServer.svc" # notice it is https - RegistrationKey = $RegistrationKey - } - } - } - - -Sample_MetaConfigurationToRegisterWithSecurePullServer -RegistrationKey $registrationkey +Sample_MetaConfigurationToRegisterWithSecurePullServer -RegistrationKey $registrationKey # =================================== Section DSC Client =================================== # diff --git a/Examples/Sample_xDscWebServiceRegistration_Win2k12and2k12R2.ps1 b/Examples/Sample_xDscWebServiceRegistration_Win2k12and2k12R2.ps1 index a129793a5..e94f24608 100644 --- a/Examples/Sample_xDscWebServiceRegistration_Win2k12and2k12R2.ps1 +++ b/Examples/Sample_xDscWebServiceRegistration_Win2k12and2k12R2.ps1 @@ -1,24 +1,13 @@ # DSC configuration for Pull Server using registration with enhanced security settings - - -# The Sample_xDscWebServiceRegistration_UseSQLProvider configuration sets up a DSC pull server that is capable for client nodes - -# to register with it and use SQL Server as a backend DB - - +# The Sample_xDscWebServiceRegistration_Win2k12and2k12R2 configuration sets up a DSC pull server that is capable for client nodes +# to register with it. # Prerequisite:1- Install a certificate in "CERT:\LocalMachine\MY\" store - # For testing environments, you could use a self-signed certificate. (New-SelfSignedCertificate cmdlet could generate one for you). - # For production environments, you will need a certificate signed by valid CA. - # Registration only works over https protocols. So to use registration feature, a secure pull server setup with certificate is necessary -# 2- Install and Configure SQL Server - - # The Sample_MetaConfigurationToRegisterWithSecurePullServer register a DSC client node with the pull server @@ -26,114 +15,68 @@ # ======================================== Arguments ======================================== # $thumbprint = (New-SelfSignedCertificate -DnsName $env:COMPUTERNAME -CertStoreLocation cert:\LocalMachine\My ).Thumbprint - -$registrationkey = [guid]::NewGuid() +$registrationKey = [guid]::NewGuid() # ======================================== Arguments ======================================== # - - -# =================================== Section DSC Client =================================== # - -configuration Sample_xDscWebServiceRegistration_UseSQLProvider - +# =================================== Section Pull Server =================================== # +configuration Sample_xDscWebServiceRegistration_Win2k12and2k12R2 { - param - ( - - [string[]]$NodeName = 'localhost', - - + [string[]] + $NodeName = 'localhost', [ValidateNotNullOrEmpty()] + [string] + $certificateThumbPrint, - [string] $certificateThumbPrint, - - - - [Parameter(HelpMessage='This should be a string with enough entropy (randomness) to protect the registration of clients to the pull server. We will use new GUID by default.')] - + [Parameter(HelpMessage = 'This should be a string with enough entropy (randomness) to protect the registration of clients to the pull server. We will use new GUID by default.')] [ValidateNotNullOrEmpty()] - - [string] $RegistrationKey # A guid that clients use to initiate conversation with pull server - + [string] + $RegistrationKey # A guid that clients use to initiate conversation with pull server ) - - Import-DSCResource -ModuleName xPSDesiredStateConfiguration + # To explicitly import the resource WindowsFesture and File. + Import-DscResource -ModuleName PSDesiredStateConfiguration Node $NodeName - { - WindowsFeature DSCServiceFeature - { - Ensure = "Present" - Name = "DSC-Service" - } - - xDscWebService PSDSCPullServer - { - - Ensure = "Present" - - EndpointName = "PSDSCPullServer" - - Port = 8080 - - PhysicalPath = "$env:SystemDrive\inetpub\PSDSCPullServer" - - CertificateThumbPrint = $certificateThumbPrint - - ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules" - - ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration" - - State = "Started" - - DependsOn = "[WindowsFeature]DSCServiceFeature" - - RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService" - + Ensure = "Present" + EndpointName = "PSDSCPullServer" + Port = 8080 + PhysicalPath = "$env:SystemDrive\inetpub\PSDSCPullServer" + CertificateThumbPrint = $certificateThumbPrint + ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules" + ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration" + State = "Started" + DependsOn = "[WindowsFeature]DSCServiceFeature" + RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService" AcceptSelfSignedCertificates = $true - - UseSecurityBestPractices = $true - - Enable32BitAppOnWin64 = $true - + UseSecurityBestPractices = $true + Enable32BitAppOnWin64 = $true } - - File RegistrationKeyFile - { - Ensure = 'Present' - Type = 'File' - DestinationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\RegistrationKeys.txt" - Contents = $RegistrationKey - } - } - } -Sample_xDscWebServiceRegistration_UseSQLProvider -RegistrationKey $registrationkey -certificateThumbPrint $thumbprint -Verbose +Sample_xDscWebServiceRegistration_Win2k12and2k12R2 -RegistrationKey $registrationKey -certificateThumbPrint $thumbprint -Verbose # =================================== Section Pull Server =================================== # # Prerequisite:1- Import a the above created certificate to "CERT:\LocalMachine\Trusted Root Certification Authority\" store @@ -145,20 +88,23 @@ configuration Sample_MetaConfigurationToRegisterWithSecurePullServer param ( [ValidateNotNullOrEmpty()] - [string] $NodeName = 'localhost', + [string] + $NodeName = 'localhost', [ValidateNotNullOrEmpty()] - [string] $RegistrationKey, #same as the one used to setup pull server in previous configuration + [string] + $RegistrationKey, #same as the one used to setup pull server in previous configuration [ValidateNotNullOrEmpty()] - [string] $ServerName = 'localhost' #node name of the pull server, same as $NodeName used in previous configuration + [string] + $ServerName = 'localhost' #node name of the pull server, same as $NodeName used in previous configuration ) Node $NodeName { Settings { - RefreshMode = 'Pull' + RefreshMode = 'Pull' } ConfigurationRepositoryWeb CONTOSO-PullSrv @@ -176,5 +122,5 @@ configuration Sample_MetaConfigurationToRegisterWithSecurePullServer } } -Sample_MetaConfigurationToRegisterWithSecurePullServer -RegistrationKey $registrationkey +Sample_MetaConfigurationToRegisterWithSecurePullServer -RegistrationKey $registrationKey # =================================== Section DSC Client =================================== # diff --git a/Examples/Sample_xDscWebServiceRemoval.ps1 b/Examples/Sample_xDscWebServiceRemoval.ps1 index 9b82ad977..445a89d66 100644 --- a/Examples/Sample_xDscWebServiceRemoval.ps1 +++ b/Examples/Sample_xDscWebServiceRemoval.ps1 @@ -1,10 +1,11 @@ # DSC configuration for removal of Pull Server and Compliance Server -configuration Sample_xDscWebService +configuration Sample_xDscWebServiceRemoval { - param + param ( - [string[]]$NodeName = 'localhost' + [string[]] + $NodeName = 'localhost' ) Import-DSCResource -ModuleName xPSDesiredStateConfiguration @@ -14,15 +15,15 @@ configuration Sample_xDscWebService WindowsFeature DSCServiceFeature { Ensure = "Present" - Name = "DSC-Service" + Name = "DSC-Service" } xDscWebService PSDSCPullServer { - Ensure = "Absent" - EndpointName = "PSDSCPullServer" - CertificateThumbPrint = "notNeededForRemoval" + Ensure = "Absent" + EndpointName = "PSDSCPullServer" + CertificateThumbPrint = "notNeededForRemoval" UseSecurityBestPractices = $false } } - } +} diff --git a/Examples/Sample_xEnvironment_CreateMultiplePathVariables.ps1 b/Examples/Sample_xEnvironment_CreateMultiplePathVariables.ps1 index 6f37c732f..63ba2c6da 100644 --- a/Examples/Sample_xEnvironment_CreateMultiplePathVariables.ps1 +++ b/Examples/Sample_xEnvironment_CreateMultiplePathVariables.ps1 @@ -8,21 +8,17 @@ #> Configuration Sample_xEnvironment_CreateMultiplePathVariables { - param () - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' Node localhost { xEnvironment CreateMultiplePathEnvironmentVariables { - Name = 'TestPathEnvironmentVariable' - Value = 'C:\test123;C:\test456;C:\test789' + Name = 'TestPathEnvironmentVariable' + Value = 'C:\test123;C:\test456;C:\test789' Ensure = 'Present' - Path = $true + Path = $true Target = @('Process', 'Machine') } } } - -Sample_xEnvironment_CreateMultiplePathVariables diff --git a/Examples/Sample_xEnvironment_CreateNonPathVariable.ps1 b/Examples/Sample_xEnvironment_CreateNonPathVariable.ps1 index 45e58cd2a..213acadcf 100644 --- a/Examples/Sample_xEnvironment_CreateNonPathVariable.ps1 +++ b/Examples/Sample_xEnvironment_CreateNonPathVariable.ps1 @@ -5,21 +5,17 @@ #> Configuration Sample_xEnvironment_CreateNonPathVariable { - param () - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' Node localhost { xEnvironment CreateEnvironmentVariable { - Name = 'TestEnvironmentVariable' - Value = 'TestValue' + Name = 'TestEnvironmentVariable' + Value = 'TestValue' Ensure = 'Present' - Path = $false + Path = $false Target = @('Process', 'Machine') } } } - -Sample_xEnvironment_CreateNonPathVariable diff --git a/Examples/Sample_xEnvironment_CreatePathVariable.ps1 b/Examples/Sample_xEnvironment_CreatePathVariable.ps1 index ed46c8fe7..77be10a11 100644 --- a/Examples/Sample_xEnvironment_CreatePathVariable.ps1 +++ b/Examples/Sample_xEnvironment_CreatePathVariable.ps1 @@ -6,21 +6,17 @@ #> Configuration Sample_xEnvironment_CreatePathVariable { - param () - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' Node localhost { xEnvironment CreatePathEnvironmentVariable { - Name = 'TestPathEnvironmentVariable' - Value = 'TestValue' + Name = 'TestPathEnvironmentVariable' + Value = 'TestValue' Ensure = 'Present' - Path = $true + Path = $true Target = @('Process', 'Machine') } } } - -Sample_xEnvironment_CreatePathVariable diff --git a/Examples/Sample_xEnvironment_Remove.ps1 b/Examples/Sample_xEnvironment_Remove.ps1 index 7ced04d78..c73060039 100644 --- a/Examples/Sample_xEnvironment_Remove.ps1 +++ b/Examples/Sample_xEnvironment_Remove.ps1 @@ -5,20 +5,16 @@ #> Configuration Sample_xEnvironment_Remove { - param () - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' Node localhost { xEnvironment RemoveEnvironmentVariable { - Name = 'TestEnvironmentVariable' + Name = 'TestEnvironmentVariable' Ensure = 'Absent' - Path = $false + Path = $false Target = @('Process', 'Machine') } } } - -Sample_xEnvironment_Remove diff --git a/Examples/Sample_xEnvironment_RemovePathVariables.ps1 b/Examples/Sample_xEnvironment_RemovePathVariables.ps1 index bbb669431..f790075b3 100644 --- a/Examples/Sample_xEnvironment_RemovePathVariables.ps1 +++ b/Examples/Sample_xEnvironment_RemovePathVariables.ps1 @@ -5,23 +5,19 @@ example, the values 'C:\test456' and 'C:\test123' will be removed, but all other entries will be left intact. In this example changes are made to applied the machine and the process. #> -Configuration Sample_xEnvironment_Path_Remove +Configuration Sample_xEnvironment_RemovePathVariables { - param () - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' Node localhost { xEnvironment RemovePathEnvironmentVariables { - Name = 'TestPathEnvironmentVariable' + Name = 'TestPathEnvironmentVariable' Ensure = 'Absent' - Path = $true - Value = "C:\test456;C;\test123" + Path = $true + Value = "C:\test456;C;\test123" Target = @('Process', 'Machine') } } } - -Sample_xEnvironment_Path_Remove diff --git a/Examples/Sample_xFileUpload.ps1 b/Examples/Sample_xFileUpload.ps1 index e263cceab..04d40b86a 100644 --- a/Examples/Sample_xFileUpload.ps1 +++ b/Examples/Sample_xFileUpload.ps1 @@ -1,28 +1,33 @@ -Configuration FileUploadConfiguration +Configuration Sample_xFileUpload { -param ( - [parameter(Mandatory = $true)] - [String] $destinationPath, - [parameter(Mandatory = $true)] - [String] $sourcePath, - [PSCredential] $credential, - [String] $certificateThumbprint -) + param ( + [parameter(Mandatory = $true)] + [String] + $destinationPath, -Import-DscResource -modulename xPSDesiredStateConfiguration -node localhost -{ - xFileUpload fileUpload + [parameter(Mandatory = $true)] + [String] + $sourcePath, + + [PSCredential] $credential, + [String] + $certificateThumbprint + ) + + Import-DscResource -modulename xPSDesiredStateConfiguration + + node localhost { - destinationPath = $destinationPath - sourcePath = $sourcePath - credential = $credential - certificateThumbprint = $certificateThumbprint + xFileUpload fileUpload + { + destinationPath = $destinationPath + sourcePath = $sourcePath + credential = $credential + certificateThumbprint = $certificateThumbprint + } } } -} - #Sample use (please change values of parameters according to your scenario): #$credential = New-Object System.Management.Automation.PSCredential -ArgumentList "domain\user", (ConvertTo-SecureString -String "password" -AsPlainText -Force) diff --git a/Examples/Sample_xGroupSet_AddMembers.ps1 b/Examples/Sample_xGroupSet_AddMembers.ps1 index abfb06f81..13c6be706 100644 --- a/Examples/Sample_xGroupSet_AddMembers.ps1 +++ b/Examples/Sample_xGroupSet_AddMembers.ps1 @@ -9,15 +9,12 @@ #> Configuration Sample_xGroupSet_AddMembers { - [CmdletBinding()] - param () - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' xGroupSet GroupSet { - GroupName = @( 'Administrators', 'GroupName1' ) - Ensure = 'Present' + GroupName = @( 'Administrators', 'GroupName1' ) + Ensure = 'Present' MembersToInclude = @( 'Username1', 'Username2' ) } } diff --git a/Examples/Sample_xGroup_RemoveMembers.ps1 b/Examples/Sample_xGroup_RemoveMembers.ps1 index 18950cd7e..fe7653612 100644 --- a/Examples/Sample_xGroup_RemoveMembers.ps1 +++ b/Examples/Sample_xGroup_RemoveMembers.ps1 @@ -7,15 +7,12 @@ #> Configuration Sample_xGroup_RemoveMembers { - [CmdletBinding()] - param () - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' xGroup Group1 { - GroupName = 'GroupName1' - Ensure = 'Present' + GroupName = 'GroupName1' + Ensure = 'Present' MembersToExclude = @( 'Username1', 'Username2' ) } } diff --git a/Examples/Sample_xGroup_SetMembers.ps1 b/Examples/Sample_xGroup_SetMembers.ps1 index e0a9f6056..9f2fc274f 100644 --- a/Examples/Sample_xGroup_SetMembers.ps1 +++ b/Examples/Sample_xGroup_SetMembers.ps1 @@ -9,15 +9,12 @@ #> Configuration Sample_xGroup_SetMembers { - [CmdletBinding()] - param () - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' xGroup Group1 { GroupName = 'GroupName1' - Ensure = 'Present' - Members = @( 'Username1', 'Username2' ) + Ensure = 'Present' + Members = @( 'Username1', 'Username2' ) } } diff --git a/Examples/Sample_xMsiPackage_InstallPackageFromFile.ps1 b/Examples/Sample_xMsiPackage_InstallPackageFromFile.ps1 index 442868e72..898c7cf41 100644 --- a/Examples/Sample_xMsiPackage_InstallPackageFromFile.ps1 +++ b/Examples/Sample_xMsiPackage_InstallPackageFromFile.ps1 @@ -21,8 +21,8 @@ Configuration Sample_xMsiPackage_InstallPackageFromFile xMsiPackage MsiPackage1 { ProductId = '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' - Path = 'file://Examples/example.msi' - Ensure = 'Present' + Path = 'file://Examples/example.msi' + Ensure = 'Present' } } } diff --git a/Examples/Sample_xMsiPackage_InstallPackageFromHttp.ps1 b/Examples/Sample_xMsiPackage_InstallPackageFromHttp.ps1 index a0349042d..b4748eb89 100644 --- a/Examples/Sample_xMsiPackage_InstallPackageFromHttp.ps1 +++ b/Examples/Sample_xMsiPackage_InstallPackageFromHttp.ps1 @@ -16,8 +16,8 @@ Configuration Sample_xMsiPackage_InstallPackageFromHttp xMsiPackage MsiPackage1 { ProductId = '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' - Path = 'http://Examples/example.msi' - Ensure = 'Present' + Path = 'http://Examples/example.msi' + Ensure = 'Present' } } } diff --git a/Examples/Sample_xMsiPackage_UninstallPackageFromFile.ps1 b/Examples/Sample_xMsiPackage_UninstallPackageFromFile.ps1 index e687a3359..8346b8c65 100644 --- a/Examples/Sample_xMsiPackage_UninstallPackageFromFile.ps1 +++ b/Examples/Sample_xMsiPackage_UninstallPackageFromFile.ps1 @@ -21,8 +21,8 @@ Configuration Sample_xMsiPackage_UninstallPackageFromFile xMsiPackage MsiPackage1 { ProductId = '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' - Path = 'file://Examples/example.msi' - Ensure = 'Absent' + Path = 'file://Examples/example.msi' + Ensure = 'Absent' } } } diff --git a/Examples/Sample_xMsiPackage_UnstallPackageFromHttps.ps1 b/Examples/Sample_xMsiPackage_UninstallPackageFromHttps.ps1 similarity index 88% rename from Examples/Sample_xMsiPackage_UnstallPackageFromHttps.ps1 rename to Examples/Sample_xMsiPackage_UninstallPackageFromHttps.ps1 index 88924a304..cf213f19b 100644 --- a/Examples/Sample_xMsiPackage_UnstallPackageFromHttps.ps1 +++ b/Examples/Sample_xMsiPackage_UninstallPackageFromHttps.ps1 @@ -16,8 +16,8 @@ Configuration Sample_xMsiPackage_UninstallPackageFromHttps xMsiPackage MsiPackage1 { ProductId = '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' - Path = 'https://Examples/example.msi' - Ensure = 'Absent' + Path = 'https://Examples/example.msi' + Ensure = 'Absent' } } } diff --git a/Examples/Sample_xPSSessionConfiguration.ps1 b/Examples/Sample_xPSSessionConfiguration.ps1 index 3f7b58cfb..433170077 100644 --- a/Examples/Sample_xPSSessionConfiguration.ps1 +++ b/Examples/Sample_xPSSessionConfiguration.ps1 @@ -1,16 +1,21 @@ -configuration Sample_xPSEndpoint_NewWithDefaults +<# + .SYNOPSIS + Creates a new xPSEndpoint using default values. +#> +configuration Example # Sample_xPSEndpoint_NewWithDefaults { param ( [Parameter(Mandatory)] - [String]$Name + [String] + $Name ) Import-DscResource -module xPSDesiredStateConfiguration xPSEndpoint PSSessionConfiguration { - Name = $Name + Name = $Name Ensure = 'Present' } } @@ -32,32 +37,36 @@ configuration Sample_xPSEndpoint_RemoveEP param ( [Parameter(Mandatory)] - [String]$Name + [String] + $Name ) Import-DscResource -module xPSDesiredStateConfiguration xPSEndpoint PSSessionConfiguration { - Name = $Name - Ensure = 'Absent' + Name = $Name + Ensure = 'Absent' } } - configuration Sample_xPSEndpoint_NewWithRunAsandStartupAndCustomSDDLAndLocalAccess { param ( [Parameter(Mandatory)] - [String]$Name, + [String] + $Name, [Parameter(Mandatory)] - [PSCredential]$RunAs, + [PSCredential] + $RunAs, - [String]$SDDL = 'Default', + [String] + $SDDL = 'Default', [Parameter(Mandatory)] - [String]$StartupScript + [String] + $StartupScript ) Import-DscResource -module xPSDesiredStateConfiguration @@ -70,7 +79,7 @@ configuration Sample_xPSEndpoint_NewWithRunAsandStartupAndCustomSDDLAndLocalAcce AccessMode = 'Local' RunAsCredential = $RunAs SecurityDescriptorSDDL = $SDDL - StartupScriptPath = $StartupScript + StartupScript = $StartupScript } } } diff --git a/Examples/Sample_xProcessSet_Start.ps1 b/Examples/Sample_xProcessSet_Start.ps1 index e5d020f47..6d34e9182 100644 --- a/Examples/Sample_xProcessSet_Start.ps1 +++ b/Examples/Sample_xProcessSet_Start.ps1 @@ -5,14 +5,11 @@ #> Configuration Sample_xProcessSet_Start { - [CmdletBinding()] - param () - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' xProcessSet xProcessSet1 { - Path = @( 'C:\Windows\System32\cmd.exe', 'C:\TestPath\TestProcess.exe' ) + Path = @( 'C:\Windows\System32\cmd.exe', 'C:\TestPath\TestProcess.exe' ) Ensure = 'Present' } } diff --git a/Examples/Sample_xProcessSet_Stop.ps1 b/Examples/Sample_xProcessSet_Stop.ps1 index afb1a58c5..a31e618d6 100644 --- a/Examples/Sample_xProcessSet_Stop.ps1 +++ b/Examples/Sample_xProcessSet_Stop.ps1 @@ -6,15 +6,12 @@ #> Configuration Sample_xProcessSet_Stop { - [CmdletBinding()] - param () - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' xProcessSet xProcessSet1 { - Path = @( 'C:\Windows\System32\cmd.exe', 'C:\TestPath\TestProcess.exe' ) - Ensure = 'Absent' + Path = @( 'C:\Windows\System32\cmd.exe', 'C:\TestPath\TestProcess.exe' ) + Ensure = 'Absent' StandardOutputPath = 'C:\OutputPath\Output.log' } } diff --git a/Examples/Sample_xRegistryResource_AddKey.ps1 b/Examples/Sample_xRegistryResource_AddKey.ps1 index aa8d58bd3..ad69eb571 100644 --- a/Examples/Sample_xRegistryResource_AddKey.ps1 +++ b/Examples/Sample_xRegistryResource_AddKey.ps1 @@ -11,8 +11,8 @@ Configuration Sample_xRegistryResource_AddKey { xRegistry Registry1 { - Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\MyNewKey' - Ensure = 'Present' + Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\MyNewKey' + Ensure = 'Present' ValueName = '' } } diff --git a/Examples/Sample_xRegistryResource_AddOrModifyValue.ps1 b/Examples/Sample_xRegistryResource_AddOrModifyValue.ps1 index ca71d8a7a..d9c038959 100644 --- a/Examples/Sample_xRegistryResource_AddOrModifyValue.ps1 +++ b/Examples/Sample_xRegistryResource_AddOrModifyValue.ps1 @@ -16,12 +16,12 @@ Configuration Sample_xRegistryResource_AddOrModifyValue { xRegistry Registry1 { - Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' - Ensure = 'Present' + Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' + Ensure = 'Present' ValueName = 'MyValue' ValueType = 'Binary' ValueData = '0x00' - Force = $true + Force = $true } } } diff --git a/Examples/Sample_xRegistryResource_RemoveKey.ps1 b/Examples/Sample_xRegistryResource_RemoveKey.ps1 index 1eda9e80e..7e7e9d6dd 100644 --- a/Examples/Sample_xRegistryResource_RemoveKey.ps1 +++ b/Examples/Sample_xRegistryResource_RemoveKey.ps1 @@ -11,8 +11,8 @@ Configuration Sample_xRegistryResource_RemoveKey { xRegistry Registry1 { - Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\MyNewKey' - Ensure = 'Absent' + Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\MyNewKey' + Ensure = 'Absent' ValueName = '' } } diff --git a/Examples/Sample_xRegistryResource_RemoveValue.ps1 b/Examples/Sample_xRegistryResource_RemoveValue.ps1 index 9d147be4f..c274335f2 100644 --- a/Examples/Sample_xRegistryResource_RemoveValue.ps1 +++ b/Examples/Sample_xRegistryResource_RemoveValue.ps1 @@ -11,8 +11,8 @@ Configuration Sample_xRegistryResource_RemoveValue { xRegistry Registry1 { - Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' - Ensure = 'Absent' + Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' + Ensure = 'Absent' ValueName = 'MyValue' } } diff --git a/Examples/Sample_xRemoteFile.ps1 b/Examples/Sample_xRemoteFile.ps1 index f500c5b41..d0e6c5a23 100644 --- a/Examples/Sample_xRemoteFile.ps1 +++ b/Examples/Sample_xRemoteFile.ps1 @@ -1,20 +1,29 @@ -configuration Sample_xRemoteFile_DownloadFile +<# + .EXAMPLE + Sample_xRemoteFile_DownloadFile +#> +configuration Sample_xRemoteFile { param ( - [string[]] $nodeName = 'localhost', + [string[]] + $nodeName = 'localhost', [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [String] $destinationPath, + [String] + $destinationPath, [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [String] $uri, + [String] + $uri, - [String] $userAgent, + [String] + $userAgent, - [Hashtable] $headers + [Hashtable] + $headers ) Import-DscResource -Name MSFT_xRemoteFile -ModuleName xPSDesiredStateConfiguration @@ -24,14 +33,14 @@ configuration Sample_xRemoteFile_DownloadFile xRemoteFile DownloadFile { DestinationPath = $destinationPath - Uri = $uri - UserAgent = $userAgent - Headers = $headers + Uri = $uri + UserAgent = $userAgent + Headers = $headers } } } -<# +<# Sample use (parameter values need to be changed according to your scenario): Sample_xRemoteFile_DownloadFile -destinationPath "$env:SystemDrive\fileName.jpg" -uri "http://www.contoso.com/image.jpg" diff --git a/Examples/Sample_xRemoteFileUsingProxy.ps1 b/Examples/Sample_xRemoteFileUsingProxy.ps1 index 1aea66a96..d0908ce61 100644 --- a/Examples/Sample_xRemoteFileUsingProxy.ps1 +++ b/Examples/Sample_xRemoteFileUsingProxy.ps1 @@ -1,22 +1,28 @@ -configuration Sample_xRemoteFile_DownloadFileUsingProxy +configuration Sample_xRemoteFileUsingProxy { param ( - [string[]] $nodeName = 'localhost', + [string[]] + $nodeName = 'localhost', [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [String] $destinationPath, + [String] + $destinationPath, [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [String] $uri, + [String] + $uri, - [String] $userAgent, + [String] + $userAgent, - [Hashtable] $headers, + [Hashtable] + $headers, - [String] $proxy + [String] + $proxy ) Import-DscResource -Name MSFT_xRemoteFile -ModuleName xPSDesiredStateConfiguration diff --git a/Examples/Sample_xScript.ps1 b/Examples/Sample_xScript.ps1 index 776883028..9766a6eb1 100644 --- a/Examples/Sample_xScript.ps1 +++ b/Examples/Sample_xScript.ps1 @@ -1,14 +1,20 @@ <# .SYNOPSIS - Creates a file at the given file path with the specified content through the xScript resource. + Creates a file at the given file path with the specified content through + the xScript resource. + + .DESCRIPTION + Creates a file at the given file path with the specified content through + the xScript resource. .PARAMETER FilePath - The path at which to create the file. + The path at which to create the file. Defaults to $env:TEMP. .PARAMETER FileContent The content to set for the new file. + Defaults to 'Just some sample text to write to the file'. #> -Configuration xScriptExample { +Configuration Sample_xScript { [CmdletBinding()] param ( @@ -29,11 +35,12 @@ Configuration xScriptExample { { xScript ScriptExample { - SetScript = { + SetScript = { $streamWriter = New-Object -TypeName 'System.IO.StreamWriter' -ArgumentList @( $using:FilePath ) $streamWriter.WriteLine($using:FileContent) $streamWriter.Close() } + TestScript = { if (Test-Path -Path $using:FilePath) { @@ -45,7 +52,8 @@ Configuration xScriptExample { return $false } } - GetScript = { + + GetScript = { $fileContent = $null if (Test-Path -Path $using:FilePath) diff --git a/Examples/Sample_xServiceSet_BuiltInAccount.ps1 b/Examples/Sample_xServiceSet_BuiltInAccount.ps1 index 1c9d57b8d..7fe55fb96 100644 --- a/Examples/Sample_xServiceSet_BuiltInAccount.ps1 +++ b/Examples/Sample_xServiceSet_BuiltInAccount.ps1 @@ -3,15 +3,18 @@ Sets the Secure Socket Tunneling Protocol and DHCP Client services to run under the built-in account LocalService. #> -Configuration xServiceSetBuiltInAccountExample +Configuration Sample_xServiceSet_BuiltInAccount { Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - xServiceSet ServiceSet1 + Node localhost { - Name = @( 'SstpSvc', 'Dhcp' ) - Ensure = 'Present' - BuiltInAccount = 'LocalService' - State = 'Ignore' + xServiceSet ServiceSet1 + { + Name = @( 'SstpSvc', 'Dhcp' ) + Ensure = 'Present' + BuiltInAccount = 'LocalService' + State = 'Ignore' + } } } diff --git a/Examples/Sample_xServiceSet_StartServices.ps1 b/Examples/Sample_xServiceSet_StartServices.ps1 index 42a879040..7a9914157 100644 --- a/Examples/Sample_xServiceSet_StartServices.ps1 +++ b/Examples/Sample_xServiceSet_StartServices.ps1 @@ -2,14 +2,17 @@ .SYNOPSIS Ensures that the DHCP Client and Windows Firewall services are running. #> -Configuration xServiceSetStartExample +Configuration Sample_xServiceSet_StartServices { Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - xServiceSet ServiceSet1 + Node localhost { - Name = @( 'Dhcp', 'MpsSvc' ) - Ensure = 'Present' - State = 'Running' + xServiceSet ServiceSet1 + { + Name = @( 'Dhcp', 'MpsSvc' ) + Ensure = 'Present' + State = 'Running' + } } } diff --git a/Examples/Sample_xService_CreateService.ps1 b/Examples/Sample_xService_CreateService.ps1 index 1c72dc73e..5c8f74248 100644 --- a/Examples/Sample_xService_CreateService.ps1 +++ b/Examples/Sample_xService_CreateService.ps1 @@ -10,19 +10,15 @@ #> Configuration Sample_xService_CreateService { - [CmdletBinding()] - param - () - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' Node localhost { xService ServiceResource1 { - Name = 'Service1' + Name = 'Service1' Ensure = 'Present' - Path = 'C:\FilePath\MyServiceExecutable.exe' + Path = 'C:\FilePath\MyServiceExecutable.exe' } } } diff --git a/Examples/Sample_xService_DeleteService.ps1 b/Examples/Sample_xService_DeleteService.ps1 index 81e8078cb..8c068a90a 100644 --- a/Examples/Sample_xService_DeleteService.ps1 +++ b/Examples/Sample_xService_DeleteService.ps1 @@ -4,17 +4,13 @@ #> Configuration Sample_xService_DeleteService { - [CmdletBinding()] - param - () - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' Node localhost { xService ServiceResource1 { - Name = 'Service1' + Name = 'Service1' Ensure = 'Absent' } } diff --git a/Examples/Sample_xService_UpdateStartupTypeIgnoreState.ps1 b/Examples/Sample_xService_UpdateStartupTypeIgnoreState.ps1 index df7098664..78db5dad0 100644 --- a/Examples/Sample_xService_UpdateStartupTypeIgnoreState.ps1 +++ b/Examples/Sample_xService_UpdateStartupTypeIgnoreState.ps1 @@ -10,19 +10,16 @@ #> Configuration Sample_xService_UpdateStartupTypeIgnoreState { - [CmdletBinding()] - param () - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' Node localhost { xService ServiceResource1 { - Name = 'Service1' - Ensure = 'Present' + Name = 'Service1' + Ensure = 'Present' StartupType = 'Manual' - State = 'Ignore' + State = 'Ignore' } } } diff --git a/Examples/Sample_xUser_CreateUser.ps1 b/Examples/Sample_xUser_CreateUser.ps1 index a278730fe..387241f54 100644 --- a/Examples/Sample_xUser_CreateUser.ps1 +++ b/Examples/Sample_xUser_CreateUser.ps1 @@ -1,16 +1,20 @@ -Configuration xUserExample +Configuration Sample_xUser_CreateUser { - param ( + param + ( [System.Management.Automation.PSCredential] $PasswordCredential ) Import-DscResource -ModuleName xPSDesiredStateConfiguration - xUser xUserExample + Node localhost { - Ensure = 'Present' # To ensure the user account does not exist, set Ensure to "Absent" - UserName = 'SomeUserName' - Password = $PasswordCredential # This needs to be a credential object + xUser xUserExample + { + Ensure = 'Present' # To ensure the user account does not exist, set Ensure to "Absent" + UserName = 'SomeUserName' + Password = $PasswordCredential # This needs to be a credential object + } } } diff --git a/Examples/Sample_xUser_Generic.ps1 b/Examples/Sample_xUser_Generic.ps1 index e0f889132..428eb7cd4 100644 --- a/Examples/Sample_xUser_Generic.ps1 +++ b/Examples/Sample_xUser_Generic.ps1 @@ -1,8 +1,8 @@ param ( - [Parameter(Mandatory)] + [Parameter()] [System.String] - $ConfigurationName + $ConfigurationName = 'Sample_xUser_Generic' ) <# @@ -13,7 +13,6 @@ param every param except username can be deleted since they are optional. #> - Configuration $ConfigurationName { param @@ -31,7 +30,7 @@ Configuration $ConfigurationName [System.String] $Ensure = 'Present', - [Parameter(Mandatory)] + [Parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $Password, @@ -50,18 +49,18 @@ Configuration $ConfigurationName Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - Node Localhost { - + Node localhost + { xUser UserResource1 { - UserName = $UserName - Ensure = $Ensure - FullName = $FullName - Description = $Description - Password = $Password - Disabled = $Disabled - PasswordNeverExpires = $PasswordNeverExpires - PasswordChangeRequired = $PasswordChangeRequired + UserName = $UserName + Ensure = $Ensure + FullName = $FullName + Description = $Description + Password = $Password + Disabled = $Disabled + PasswordNeverExpires = $PasswordNeverExpires + PasswordChangeRequired = $PasswordChangeRequired PasswordChangeNotAllowed = $PasswordChangeNotAllowed } } diff --git a/Examples/Sample_xWindowsFeature.ps1 b/Examples/Sample_xWindowsFeature.ps1 index e1e337f80..0999adae6 100644 --- a/Examples/Sample_xWindowsFeature.ps1 +++ b/Examples/Sample_xWindowsFeature.ps1 @@ -5,9 +5,11 @@ LogPath and Credential are not included here, but if you would like to specify a custom log path or need a credential just pass in the desired values and add LogPath = $LogPath and/or Credential = $Credential to the configuration here -#> -Configuration 'Install_Feature_Telnet_Client' + .EXAMPLE + Install_Feature_Telnet_Client +#> +Configuration Sample_xWindowsFeature { param ( @@ -32,12 +34,12 @@ Configuration 'Install_Feature_Telnet_Client' Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - Node Localhost { - + Node localhost + { xWindowsFeature WindowsFeatureTest { - Name = $Name - Ensure = $Ensure + Name = $Name + Ensure = $Ensure IncludeAllSubFeature = $IncludeAllSubFeature } } diff --git a/Examples/Sample_xWindowsFeatureSet_Install.ps1 b/Examples/Sample_xWindowsFeatureSet_Install.ps1 index 0af76c1e2..dc4e60374 100644 --- a/Examples/Sample_xWindowsFeatureSet_Install.ps1 +++ b/Examples/Sample_xWindowsFeatureSet_Install.ps1 @@ -3,18 +3,18 @@ Installs the TelnetClient and RSAT-File-Services Windows features, including all their subfeatures. Logs the operation to the file at 'C:\LogPath\Log.log'. #> -Configuration xWindowsFeatureSetExample_Install +Configuration Sample_xWindowsFeatureSet_Install { - [CmdletBinding()] - param () - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - xWindowsFeatureSet WindowsFeatureSet1 + Node localhost { - Name = @( 'Telnet-Client', 'RSAT-File-Services' ) - Ensure = 'Present' - IncludeAllSubFeature = $true - LogPath = 'C:\LogPath\Log.log' + xWindowsFeatureSet WindowsFeatureSet1 + { + Name = @( 'Telnet-Client', 'RSAT-File-Services' ) + Ensure = 'Present' + IncludeAllSubFeature = $true + LogPath = 'C:\LogPath\Log.log' + } } } diff --git a/Examples/Sample_xWindowsFeatureSet_Uninstall.ps1 b/Examples/Sample_xWindowsFeatureSet_Uninstall.ps1 index 996d0829d..079a005c4 100644 --- a/Examples/Sample_xWindowsFeatureSet_Uninstall.ps1 +++ b/Examples/Sample_xWindowsFeatureSet_Uninstall.ps1 @@ -3,18 +3,18 @@ Uninstalls the TelnetClient and RSAT-File-Services Windows features, including all their subfeatures. Logs the operation to the file at 'C:\LogPath\Log.log'. #> -Configuration xWindowsFeatureSetExample_Install +Configuration Sample_xWindowsFeatureSet_Uninstall { - [CmdletBinding()] - param () - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - xWindowsFeatureSet WindowsFeatureSet1 + Node localhost { - Name = @( 'Telnet-Client', 'RSAT-File-Services' ) - Ensure = 'Absent' - IncludeAllSubFeature = $true - LogPath = 'C:\LogPath\Log.log' + xWindowsFeatureSet WindowsFeatureSet1 + { + Name = @( 'Telnet-Client', 'RSAT-File-Services' ) + Ensure = 'Absent' + IncludeAllSubFeature = $true + LogPath = 'C:\LogPath\Log.log' + } } } diff --git a/Examples/Sample_xWindowsOptionalFeature.ps1 b/Examples/Sample_xWindowsOptionalFeature.ps1 index 23d95e95b..25876226e 100644 --- a/Examples/Sample_xWindowsOptionalFeature.ps1 +++ b/Examples/Sample_xWindowsOptionalFeature.ps1 @@ -27,12 +27,13 @@ Configuration Sample_xWindowsOptionalFeature Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - xWindowsOptionalFeature TelnetClient + Node localhost { - Name = $FeatureName - Ensure = 'Present' - LogPath = $LogPath + xWindowsOptionalFeature TelnetClient + { + Name = $FeatureName + Ensure = 'Present' + LogPath = $LogPath + } } } - -Sample_xWindowsOptionalFeature diff --git a/Examples/Sample_xWindowsOptionalFeatureSet_Disable.ps1 b/Examples/Sample_xWindowsOptionalFeatureSet_Disable.ps1 index dd66aa244..dd5813e4a 100644 --- a/Examples/Sample_xWindowsOptionalFeatureSet_Disable.ps1 +++ b/Examples/Sample_xWindowsOptionalFeatureSet_Disable.ps1 @@ -3,7 +3,7 @@ Disables the Windows optional features TelnetClient and LegacyComponents and removes all files associated with these features. #> -Configuration xWindowsOptionalFeatureSet_Disable +Configuration Sample_xWindowsOptionalFeatureSet_Disable { Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' diff --git a/Examples/Sample_xWindowsOptionalFeatureSet_Enable.ps1 b/Examples/Sample_xWindowsOptionalFeatureSet_Enable.ps1 index 45cba7f77..4096d9ad8 100644 --- a/Examples/Sample_xWindowsOptionalFeatureSet_Enable.ps1 +++ b/Examples/Sample_xWindowsOptionalFeatureSet_Enable.ps1 @@ -4,14 +4,17 @@ Internet-Explorer-Optional-amd64 and outputs a log of the operations to a file at the path 'C:\LogPath\Log.txt'. #> -Configuration xWindowsOptionalFeatureSet_Enable +Configuration Sample_xWindowsOptionalFeatureSet_Enable { Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - xWindowsOptionalFeatureSet WindowsOptionalFeatureSet1 + Node localhost { - Name = @('MicrosoftWindowsPowerShellV2', 'Internet-Explorer-Optional-amd64') - Ensure = 'Present' - LogPath = 'C:\LogPath\Log.txt' + xWindowsOptionalFeatureSet WindowsOptionalFeatureSet1 + { + Name = @('MicrosoftWindowsPowerShellV2', 'Internet-Explorer-Optional-amd64') + Ensure = 'Present' + LogPath = 'C:\LogPath\Log.txt' + } } } diff --git a/Examples/Sample_xWindowsPackageCab.ps1 b/Examples/Sample_xWindowsPackageCab.ps1 index 25a0cdb26..c84d2af34 100644 --- a/Examples/Sample_xWindowsPackageCab.ps1 +++ b/Examples/Sample_xWindowsPackageCab.ps1 @@ -37,13 +37,14 @@ Configuration Sample_xWindowsPackageCab Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - xWindowsPackageCab WindowsPackageCab1 + Node localhost { - Name = $Name - Ensure = 'Present' - SourcePath = $SourcePath - LogPath = $LogPath + xWindowsPackageCab WindowsPackageCab1 + { + Name = $Name + Ensure = 'Present' + SourcePath = $SourcePath + LogPath = $LogPath + } } } - -Sample_xWindowsPackageCab diff --git a/Examples/Sample_xWindowsProcess_Start.ps1 b/Examples/Sample_xWindowsProcess_Start.ps1 index 588306c8d..11ea577f5 100644 --- a/Examples/Sample_xWindowsProcess_Start.ps1 +++ b/Examples/Sample_xWindowsProcess_Start.ps1 @@ -5,21 +5,15 @@ #> Configuration Sample_xWindowsProcess_Start { - param - () - Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' Node localhost { xWindowsProcess GPresult { - Path = 'C:\Windows\System32\gpresult.exe' + Path = 'C:\Windows\System32\gpresult.exe' Arguments = '/h C:\gp2.htm' - Ensure = 'Present' + Ensure = 'Present' } } } - -Sample_xWindowsProcess_Start - diff --git a/Examples/Sample_xWindowsProcess_StartUnderUser.ps1 b/Examples/Sample_xWindowsProcess_StartUnderUser.ps1 index ff7b89586..ad334293f 100644 --- a/Examples/Sample_xWindowsProcess_StartUnderUser.ps1 +++ b/Examples/Sample_xWindowsProcess_StartUnderUser.ps1 @@ -11,9 +11,9 @@ Configuration Sample_xWindowsProcess_StartUnderUser [CmdletBinding()] param ( - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential = (Get-Credential) + [System.Management.Automation.PSCredential] + [System.Management.Automation.Credential()] + $Credential = (Get-Credential) ) Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' @@ -22,15 +22,15 @@ Configuration Sample_xWindowsProcess_StartUnderUser { xWindowsProcess GPresult { - Path = 'C:\Windows\System32\gpresult.exe' - Arguments = '/h C:\gp2.htm' + Path = 'C:\Windows\System32\gpresult.exe' + Arguments = '/h C:\gp2.htm' Credential = $Credential - Ensure = 'Present' + Ensure = 'Present' } } } -<# +<# To use the sample(s) with credentials, see blog at: http://blogs.msdn.com/b/powershell/archive/2014/01/31/want-to-secure-credentials-in-windows-powershell-desired-state-configuration.aspx #> diff --git a/Examples/Sample_xWindowsProcess_Stop.ps1 b/Examples/Sample_xWindowsProcess_Stop.ps1 index cd30f8e1f..304b230a8 100644 --- a/Examples/Sample_xWindowsProcess_Stop.ps1 +++ b/Examples/Sample_xWindowsProcess_Stop.ps1 @@ -1,26 +1,20 @@ <# .SYNOPSIS - Stops the gpresult process if it is running. + Stops the gpresult process if it is running. Since the Arguments parameter isn't needed to stop the process, an empty string is passed in. #> Configuration Sample_xWindowsProcess_Stop { - param - () - Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' Node localhost { xWindowsProcess GPresult { - Path = 'C:\Windows\System32\gpresult.exe' + Path = 'C:\Windows\System32\gpresult.exe' Arguments = '' - Ensure = 'Absent' + Ensure = 'Absent' } } } - -Sample_xWindowsProcess_Stop - diff --git a/Examples/Sample_xWindowsProcess_StopUnderUser.ps1 b/Examples/Sample_xWindowsProcess_StopUnderUser.ps1 index 2cc150cbf..97b817786 100644 --- a/Examples/Sample_xWindowsProcess_StopUnderUser.ps1 +++ b/Examples/Sample_xWindowsProcess_StopUnderUser.ps1 @@ -12,26 +12,27 @@ Configuration Sample_xWindowsProcess_StopUnderUser [CmdletBinding()] param ( - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential = (Get-Credential) + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + [System.Management.Automation.Credential()] + $Credential = (Get-Credential) ) + Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' Node localhost { xWindowsProcess GPresult { - Path = 'C:\Windows\System32\gpresult.exe' - Arguments = '' + Path = 'C:\Windows\System32\gpresult.exe' + Arguments = '' Credential = $Credential - Ensure = 'Absent' + Ensure = 'Absent' } } } - -<# + +<# To use the sample(s) with credentials, see blog at: http://blogs.msdn.com/b/powershell/archive/2014/01/31/want-to-secure-credentials-in-windows-powershell-desired-state-configuration.aspx #> diff --git a/README.md b/README.md index 4d3136743..eda863506 100644 --- a/README.md +++ b/README.md @@ -656,6 +656,10 @@ Publishes a 'FileInfo' object(s) to the pullserver configuration repository. It * Changes to xPSDesiredStateConfiguration * Opt-in for the common tests validate module files and script files. * All files change to encoding UTF-8 (without byte order mark). + * Opt-in for the common test for example validation. + * Added Visual Studio Code workspace settings that helps with formatting + against the style guideline. + * Update all examples for them to be able pass the common test validation. * xEnvironment path documentation update demonstrating usage with multiple values ([issue #415](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/415). [Alex Kokkinos (@alexkokkinos)](https://github.com/alexkokkinos) ### 8.3.0.0 diff --git a/Tests/Unit/ResourceSetHelper.Tests.ps1 b/Tests/Unit/ResourceSetHelper.Tests.ps1 index 2e5c8ffc0..a681edf09 100644 --- a/Tests/Unit/ResourceSetHelper.Tests.ps1 +++ b/Tests/Unit/ResourceSetHelper.Tests.ps1 @@ -8,7 +8,11 @@ $script:testsFolderFilePath = Split-Path -Path $PSScriptRoot -Parent $script:moduleRootFilePath = Split-Path -Path $script:testsFolderFilePath -Parent $script:dscResourcesFolderFilePath = Join-Path -Path $script:moduleRootFilePath -ChildPath 'DscResources' $script:resourceSetHelperFilePath = Join-Path -Path $script:dscResourcesFolderFilePath -ChildPath "ResourceSetHelper.psm1" -Import-Module -Name $script:resourceSetHelperFilePath + +# Make sure that any lingering copies of the module that is tested are removed. +Get-Module -Name 'ResourceSetHelper' -All | Remove-Module -Force -ErrorAction SilentlyContinue +# Import the module that is being tested. +Import-Module -Name $script:resourceSetHelperFilePath -Force InModuleScope 'ResourceSetHelper' { Describe 'ResourceSetHelper\New-ResourceSetCommonParameterString' { From 5535f5128ec128440b6623f315ac7cd294c545ec Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Tue, 3 Jul 2018 17:21:06 +0200 Subject: [PATCH 5/9] Add examples to PowerShell Gallery (#429) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changes to xWindowsProcess - Increased the wait time in the integration tests since the tests still failed randomly (issue #420). - Renamed and updated examples to be able to publish them to PowerShell Gallery. - Sample_xScript.ps1 → xScript_WatchFileContentConfig.ps1 - Sample_xService_UpdateStartupTypeIgnoreState.ps1 → xService_UpdateStartupTypeIgnoreStateConfig.ps1 --- .MetaTestOptIn.json | 3 +- Examples/Sample_xScript.ps1 | 70 ------------- ..._xService_UpdateStartupTypeIgnoreState.ps1 | 25 ----- Examples/xScript_WatchFileContentConfig.ps1 | 97 +++++++++++++++++++ ...ice_UpdateStartupTypeIgnoreStateConfig.ps1 | 64 ++++++++++++ README.md | 9 +- ...MSFT_xWindowsProcess.Integration.Tests.ps1 | 24 ++--- appveyor.yml | 18 +++- 8 files changed, 198 insertions(+), 112 deletions(-) delete mode 100644 Examples/Sample_xScript.ps1 delete mode 100644 Examples/Sample_xService_UpdateStartupTypeIgnoreState.ps1 create mode 100644 Examples/xScript_WatchFileContentConfig.ps1 create mode 100644 Examples/xService_UpdateStartupTypeIgnoreStateConfig.ps1 diff --git a/.MetaTestOptIn.json b/.MetaTestOptIn.json index 60106a20f..7ee31e96a 100644 --- a/.MetaTestOptIn.json +++ b/.MetaTestOptIn.json @@ -1,5 +1,6 @@ [ "Common Tests - Validate Module Files", "Common Tests - Validate Script Files", - "Common Tests - Validate Example Files" + "Common Tests - Validate Example Files", + "Common Tests - Validate Example Files To Be Published" ] diff --git a/Examples/Sample_xScript.ps1 b/Examples/Sample_xScript.ps1 deleted file mode 100644 index 9766a6eb1..000000000 --- a/Examples/Sample_xScript.ps1 +++ /dev/null @@ -1,70 +0,0 @@ -<# - .SYNOPSIS - Creates a file at the given file path with the specified content through - the xScript resource. - - .DESCRIPTION - Creates a file at the given file path with the specified content through - the xScript resource. - - .PARAMETER FilePath - The path at which to create the file. Defaults to $env:TEMP. - - .PARAMETER FileContent - The content to set for the new file. - Defaults to 'Just some sample text to write to the file'. -#> -Configuration Sample_xScript { - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $FilePath, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $FileContent - ) - - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xScript ScriptExample - { - SetScript = { - $streamWriter = New-Object -TypeName 'System.IO.StreamWriter' -ArgumentList @( $using:FilePath ) - $streamWriter.WriteLine($using:FileContent) - $streamWriter.Close() - } - - TestScript = { - if (Test-Path -Path $using:FilePath) - { - $fileContent = Get-Content -Path $using:filePath -Raw - return $fileContent -eq $using:FileContent - } - else - { - return $false - } - } - - GetScript = { - $fileContent = $null - - if (Test-Path -Path $using:FilePath) - { - $fileContent = Get-Content -Path $using:filePath -Raw - } - - return @{ - Result = Get-Content -Path $fileContent - } - } - } - } -} diff --git a/Examples/Sample_xService_UpdateStartupTypeIgnoreState.ps1 b/Examples/Sample_xService_UpdateStartupTypeIgnoreState.ps1 deleted file mode 100644 index 78db5dad0..000000000 --- a/Examples/Sample_xService_UpdateStartupTypeIgnoreState.ps1 +++ /dev/null @@ -1,25 +0,0 @@ -<# - .SYNOPSIS - If the service with the name Service1 does not exist, this configuration would throw an - error since the Path is not included here. - - If the service with the name Service1 already exists, sets the startup type of the service - with the name Service1 to Manual and ignores the state that the service is currently in. - If State is not specified, the configuration will ensure that the state of the service is - Running by default. -#> -Configuration Sample_xService_UpdateStartupTypeIgnoreState -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xService ServiceResource1 - { - Name = 'Service1' - Ensure = 'Present' - StartupType = 'Manual' - State = 'Ignore' - } - } -} diff --git a/Examples/xScript_WatchFileContentConfig.ps1 b/Examples/xScript_WatchFileContentConfig.ps1 new file mode 100644 index 000000000..2dfc450d0 --- /dev/null +++ b/Examples/xScript_WatchFileContentConfig.ps1 @@ -0,0 +1,97 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID f9306ebe-8af5-4dee-baf3-f3fac17891db +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that make sure the file exist at the given file path with + the specified content. + + .DESCRIPTION + Configuration that creates a file at the given file path with the + specified content, using the xScript resource. + If the content of the file is changed, the configuration will update + the file content to match the content in the configuration. + + .PARAMETER FilePath + The path at which to create the file. + + .PARAMETER FileContent + The content to set in the file. + + .EXAMPLE + xScript_WatchFileContentConfig -FilePath 'C:\test.txt' -FileContent 'Just some sample text to write to the file' + + Compiles a configuration that make sure the is a file 'C:\test.txt' with + the content 'Just some sample text to write to the file'. +#> +Configuration xScript_WatchFileContentConfig { + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true, HelpMessage='The path at which to create the file.')] + [ValidateNotNullOrEmpty()] + [String] + $FilePath, + + [Parameter(Mandatory = $true, HelpMessage='The content to set in the file.')] + [ValidateNotNullOrEmpty()] + [String] + $FileContent + ) + + Import-DscResource -ModuleName xPSDesiredStateConfiguration + + Node localhost + { + xScript ScriptExample + { + SetScript = { + $streamWriter = New-Object -TypeName 'System.IO.StreamWriter' -ArgumentList @( $using:FilePath ) + $streamWriter.WriteLine($using:FileContent) + $streamWriter.Close() + } + + TestScript = { + if (Test-Path -Path $using:FilePath) + { + $fileContent = Get-Content -Path $using:filePath -Raw + return $fileContent -eq $using:FileContent + } + else + { + return $false + } + } + + GetScript = { + $fileContent = $null + + if (Test-Path -Path $using:FilePath) + { + $fileContent = Get-Content -Path $using:filePath -Raw + } + + return @{ + Result = $fileContent + } + } + } + } +} + diff --git a/Examples/xService_UpdateStartupTypeIgnoreStateConfig.ps1 b/Examples/xService_UpdateStartupTypeIgnoreStateConfig.ps1 new file mode 100644 index 000000000..fb4fd9441 --- /dev/null +++ b/Examples/xService_UpdateStartupTypeIgnoreStateConfig.ps1 @@ -0,0 +1,64 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 5a442bad-d301-463e-9510-79193ff1bf88 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that updates startup type to manual for the service Print + Spooler, ignoring it's current state (e.g. running, stopped, etc). + + .DESCRIPTION + Configuration that updates startup type to manual for the service Print + Spooler, ignoring it's current state (e.g. running, stopped, etc). + + .NOTES + If the service with the name spooler does not exist, this configuration would throw an + error since the Path is not included here. + + If the service with the name spooler already exists, sets the startup type of the service + with the name spooler to Manual and ignores the state that the service is currently in. + If State is not specified, the configuration will ensure that the state of the service is + Running by default. + + .EXAMPLE + xService_UpdateStartupTypeIgnoreStateConfig + + Compiles a configuration that make sure the service Print Spooler + has the startup type set to 'Manual' regardless of the current state + of the service (e.g. running, stopped, etc). +#> +Configuration xService_UpdateStartupTypeIgnoreStateConfig +{ + [CmdletBinding()] + param () + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xService ServiceResource1 + { + Name = 'spooler' + Ensure = 'Present' + StartupType = 'Manual' + State = 'Ignore' + } + } +} + + diff --git a/README.md b/README.md index eda863506..cca8a1584 100644 --- a/README.md +++ b/README.md @@ -272,6 +272,7 @@ None * [Create a service](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xService_CreateService.ps1) * [Delete a service](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xService_DeleteService.ps1) +* [Update startup type for a service, and ignoring the current state](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xService_UpdateStartupTypeIgnoreStateConfig.ps1) ### xServiceSet Provides a mechanism to configure and manage multiple xService resources with common settings but different names. @@ -438,7 +439,7 @@ None #### Examples -* [Create a file with content through xScript](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xScript.ps1) +* [Create a file with content through xScript](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xScript_WatchFileContentConfig.ps1) ### xRegistry @@ -661,6 +662,12 @@ Publishes a 'FileInfo' object(s) to the pullserver configuration repository. It against the style guideline. * Update all examples for them to be able pass the common test validation. * xEnvironment path documentation update demonstrating usage with multiple values ([issue #415](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/415). [Alex Kokkinos (@alexkokkinos)](https://github.com/alexkokkinos) +* Changes to xWindowsProcess + * Increased the wait time in the integration tests since the tests + still failed randomly ([issue #420](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/420)). +* Renamed and updated examples to be able to publish them to PowerShell Gallery. + * Sample\_xScript.ps1 → xScript\_WatchFileContentConfig.ps1 + * Sample\_xService\_UpdateStartupTypeIgnoreState.ps1 → xService\_UpdateStartupTypeIgnoreStateConfig.ps1 ### 8.3.0.0 diff --git a/Tests/Integration/MSFT_xWindowsProcess.Integration.Tests.ps1 b/Tests/Integration/MSFT_xWindowsProcess.Integration.Tests.ps1 index 8bb92912c..12d14614c 100644 --- a/Tests/Integration/MSFT_xWindowsProcess.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_xWindowsProcess.Integration.Tests.ps1 @@ -52,7 +52,7 @@ try } # Wait a moment for the process to stop/start - $null = Start-Sleep -Seconds 1 + $null = Start-Sleep -Seconds 2 It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw @@ -93,7 +93,7 @@ try } # Wait a moment for the process to stop/start - $null = Start-Sleep -Seconds 1 + $null = Start-Sleep -Seconds 2 It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw @@ -139,7 +139,7 @@ try } # Wait a moment for the process to stop/start - $null = Start-Sleep -Seconds 1 + $null = Start-Sleep -Seconds 2 It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw @@ -181,7 +181,7 @@ try } # Wait a moment for the process to stop/start - $null = Start-Sleep -Seconds 1 + $null = Start-Sleep -Seconds 2 It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw @@ -222,7 +222,7 @@ try } # Wait a moment for the process to stop/start - $null = Start-Sleep -Seconds 1 + $null = Start-Sleep -Seconds 2 It 'Should start another process running' { Start-Process -FilePath $testProcessPath -ArgumentList @($logFilePath) @@ -272,7 +272,7 @@ try } # Wait a moment for the process to stop/start - $null = Start-Sleep -Seconds 1 + $null = Start-Sleep -Seconds 2 It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw @@ -339,7 +339,7 @@ try } # Wait a moment for the process to stop/start - $null = Start-Sleep -Seconds 1 + $null = Start-Sleep -Seconds 2 It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw @@ -382,7 +382,7 @@ try } # Wait a moment for the process to stop/start - $null = Start-Sleep -Seconds 1 + $null = Start-Sleep -Seconds 2 It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw @@ -430,7 +430,7 @@ try } # Wait a moment for the process to stop/start - $null = Start-Sleep -Seconds 1 + $null = Start-Sleep -Seconds 2 It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw @@ -474,7 +474,7 @@ try } # Wait a moment for the process to stop/start - $null = Start-Sleep -Seconds 1 + $null = Start-Sleep -Seconds 2 It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw @@ -517,7 +517,7 @@ try } # Wait a moment for the process to stop/start - $null = Start-Sleep -Seconds 1 + $null = Start-Sleep -Seconds 2 It 'Should start another process running' { Start-Process -FilePath $testProcessPath -ArgumentList @($logFilePath) @@ -574,7 +574,7 @@ try } # Wait a moment for the process to stop/start - $null = Start-Sleep -Seconds 1 + $null = Start-Sleep -Seconds 2 It 'Should be able to call Get-DscConfiguration without throwing' { { Get-DscConfiguration -ErrorAction 'Stop' } | Should Not Throw diff --git a/appveyor.yml b/appveyor.yml index 880c069a5..f355cc89c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,6 +2,14 @@ # environment configuration # #---------------------------------# version: 6.0.{build}.0 +environment: + gallery_api: + secure: 9ekJzfsPCDBkyLrfmov83XbbhZ6E2N3z+B/Io8NbDetbHc6hWS19zsDmy7t0Vvxv + +init: + # Needed for publishing of examples, build worker defaults to core.autocrlf=input. + - git config --global core.autocrlf true + install: - git clone https://github.com/PowerShell/DscResource.Tests - ps: | @@ -28,12 +36,16 @@ test_script: -DisableConsistency ` -ExcludeTag @() +after_test: + - ps: | + Import-Module -Name "$env:APPVEYOR_BUILD_FOLDER\DscResource.Tests\AppVeyor.psm1" + Invoke-AppveyorAfterTestTask ` + -ResourceModuleName $moduleName + #---------------------------------# # deployment configuration # #---------------------------------# -# scripts to run before deployment deploy_script: - ps: | - Invoke-AppveyorAfterTestTask ` - -ResourceModuleName $moduleName + Invoke-AppVeyorDeployTask From 8908dd960dbd2c47e6308bee1b00f095076037ae Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Wed, 4 Jul 2018 07:09:54 +0200 Subject: [PATCH 6/9] Add more examples to PowerShell Gallery (#430) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Renamed and updated examples to be able to publish them to PowerShell Gallery. - Sample\_xWindowsProcess\_Start.ps1 → xWindowsProcess\_StartProcessConfig.ps1 - Sample\_xWindowsProcess\_StartUnderUser.ps1 → xWindowsProcess\_StartProcessUnderUserConfig.ps1 - Sample\_xWindowsProcess\_Stop.ps1 → xWindowsProcess\_StopProcessConfig.ps1 - Sample\_xWindowsProcess\_StopUnderUser.ps1 → xWindowsProcess\_StopProcessUnderUserConfig.ps1 - Sample\_xUser\_CreateUser.ps1.ps1 → xUser\_CreateUserConfig.ps1 - Sample\_xUser\_Generic.ps1.ps1 → xUser\_CreateUserDetailedConfig.ps1 - Sample\_xWindowsFeature.ps1 → xWindowsFeature\_AddFeatureConfig.ps1 - Sample\_xWindowsFeatureSet\_Install.ps1 → xWindowsFeatureSet\_AddFeaturesConfig.ps1 - Sample\_xWindowsFeatureSet\_Uninstall.ps1 → xWindowsFeatureSet\_RemoveFeaturesConfig.ps1 - Sample\_xRegistryResource\_AddKey.ps1 → xRegistryResource\_AddKeyConfig.ps1 - Sample\_xRegistryResource\_RemoveKey.ps1 → xRegistryResource\_RemoveKeyConfig.ps1 - Sample\_xRegistryResource\_AddOrModifyValue.ps1 → xRegistryResource\_AddOrModifyValueConfig.ps1 - Sample\_xRegistryResource\_RemoveValue.ps1 → xRegistryResource\_RemoveValueConfig.ps1 - Sample\_xService\_CreateService.ps1 → xService\_CreateServiceConfig.ps1 - Sample\_xService\_DeleteService.ps1 → xService\_RemoveServiceConfig.ps1 - Sample\_xServiceSet\_StartServices.ps1 → xServiceSet\_StartServicesConfig.ps1 - Sample\_xServiceSet\_BuiltInAccount → xServiceSet\_EnsureBuiltInAccountConfig.ps1 - Sample\_xWindowsPackageCab → xWindowsPackageCab\_InstallPackageConfig - Sample\_xWindowsOptionalFeature.ps1 → xWindowsOptionalFeature\_EnableConfig.ps1 - Sample\_xWindowsOptionalFeatureSet\_Enable.ps1 → xWindowsOptionalFeatureSet\_EnableConfig.ps1 - Sample\_xWindowsOptionalFeatureSet\_Disable.ps1 → xWindowsOptionalFeatureSet\_DisableConfig.ps1 - Sample\_xRemoteFileUsingProxy.ps1 → xRemoteFile\_DownloadFileUsingProxyConfig.ps1 - Sample\_xRemoteFile.ps1 → xRemoteFile\_DownloadFileConfig.ps1 - Sample\_xProcessSet\_Start.ps1 → xProcessSet\_StartProcessConfig.ps1 - Sample\_xProcessSet\_Stop.ps1 → xProcessSet\_StopProcessConfig.ps1 - Sample\_xMsiPackage\_UninstallPackageFromHttps.ps1 → xMsiPackage\_UninstallPackageFromHttpsConfig.ps1 - Sample\_xMsiPackage\_UninstallPackageFromFile.ps1 → xMsiPackage\_UninstallPackageFromFileConfig.ps1 - Sample\_xMsiPackage\_InstallPackageFromFile → xMsiPackage\_InstallPackageConfig.ps1 - Sample\_xGroup\_SetMembers.ps1 → xGroup\_SetMembersConfig.ps1 - Sample\_xGroup\_RemoveMembers.ps1 → xGroup\_RemoveMembersConfig.ps1 - Sample\_xGroupSet\_AddMembers.ps1 → xGroupSet\_AddMembersConfig.ps1 - Sample\_xFileUpload.ps1 → xFileUpload\_UploadToSMBShareConfig.ps1 - Sample\_xEnvironment\_CreateMultiplePathVariables.ps1 → xEnvironment\_AddMultiplePathsConfig.ps1 - Sample\_xEnvironment\_RemovePathVariables.ps1 → xEnvironment\_RemoveMultiplePathsConfig.ps1 - Sample\_xEnvironment\_CreateNonPathVariable.ps1 → xEnvironment\_CreateNonPathVariableConfig.ps1 - Sample\_xEnvironment\_Remove.ps1 → xEnvironment\_RemoveVariableConfig.ps1 - Sample\_xArchive\_ExpandArchiveChecksumAndForce.ps1 → xArchive\_ExpandArchiveChecksumAndForceConfig.ps1 - Sample\_xArchive\_ExpandArchiveDefaultValidationAndForce.ps1 → xArchive\_ExpandArchiveDefaultValidationAndForceConfig.ps1 - Sample\_xArchive\_ExpandArchiveNoValidation.ps1 → xArchive\_ExpandArchiveNoValidationConfig.ps1 - Sample\_xArchive\_ExpandArchiveNoValidationCredential.ps1 → xArchive\_ExpandArchiveNoValidationCredentialConfig.ps1 - Sample\_xArchive\_RemoveArchiveChecksum.ps1 → xArchive\_RemoveArchiveChecksumConfig.ps1 - Sample\_xArchive\_RemoveArchiveNoValidation.ps1 → xArchive\_RemoveArchiveNoValidationConfig.ps1 - Sample\_InstallExeCreds\_xPackage.ps1 → xPackage\_InstallExeUsingCredentialsConfig.ps1 - Sample\_InstallExeCredsRegistry\_xPackage.ps1 → xPackage\_InstallExeUsingCredentialsAndRegistryConfig.ps1 - Sample\_InstallMSI\_xPackage.ps1 → xPackage\_InstallMsiConfig.ps1 - Sample\_InstallMSIProductId\_xPackage.ps1 → xPackage\_InstallMsiUsingProductIdConfig.ps1 - New examples - xUser\_RemoveUserConfig.ps1 - xWindowsFeature\_AddFeatureUsingCredentialConfig.ps1 - xWindowsFeature\_AddFeatureWithLogPathConfig.ps1 - xWindowsFeature\_RemoveFeatureConfig.ps1 - xService\_ChangeServiceStateConfig.ps1 - xWindowsOptionalFeature\_DisableConfig.ps1 - xPSEndpoint\_NewConfig.ps1 - xPSEndpoint\_NewWithDefaultsConfig.ps1 - xPSEndpoint\_RemoveConfig.ps1 - xPSEndpoint\_NewCustomConfig.ps1 - Removed examples - Sample\_xPSSessionConfiguration.ps1 - This file was split up in several examples, those starting with 'xPSEndpoint-'. - Sample\_xMsiPackage\_InstallPackageFromHttp - This was added to the example xMsiPackage\_InstallPackageConfig.ps1 so the example sows either URI scheme. - Sample\_xEnvironment\_CreatePathVariable.ps1 - Same as the new example xEnvironment\_AddMultiplePaths.ps1 --- ...ample_InstallExeCredsRegistry_xPackage.ps1 | 81 ------- Examples/Sample_InstallExeCreds_xPackage.ps1 | 63 ------ .../Sample_InstallMSIProductId_xPackage.ps1 | 42 ---- Examples/Sample_InstallMSI_xPackage.ps1 | 37 ---- ...xArchive_ExpandArchiveChecksumAndForce.ps1 | 30 --- ...ExpandArchiveDefaultValidationAndForce.ps1 | 29 --- ...ple_xArchive_ExpandArchiveNoValidation.ps1 | 23 -- ...ve_ExpandArchiveNoValidationCredential.ps1 | 35 --- .../Sample_xArchive_RemoveArchiveChecksum.ps1 | 25 --- ...ple_xArchive_RemoveArchiveNoValidation.ps1 | 23 -- ...nvironment_CreateMultiplePathVariables.ps1 | 24 --- ...ple_xEnvironment_CreateNonPathVariable.ps1 | 21 -- ...Sample_xEnvironment_CreatePathVariable.ps1 | 22 -- Examples/Sample_xEnvironment_Remove.ps1 | 20 -- ...ample_xEnvironment_RemovePathVariables.ps1 | 23 -- Examples/Sample_xFileUpload.ps1 | 36 ---- Examples/Sample_xGroupSet_AddMembers.ps1 | 20 -- Examples/Sample_xGroup_RemoveMembers.ps1 | 18 -- Examples/Sample_xGroup_SetMembers.ps1 | 20 -- ...ple_xMsiPackage_InstallPackageFromFile.ps1 | 28 --- ...ple_xMsiPackage_InstallPackageFromHttp.ps1 | 23 -- ...e_xMsiPackage_UninstallPackageFromFile.ps1 | 28 --- ..._xMsiPackage_UninstallPackageFromHttps.ps1 | 23 -- Examples/Sample_xPSSessionConfiguration.ps1 | 87 -------- Examples/Sample_xProcessSet_Start.ps1 | 15 -- Examples/Sample_xProcessSet_Stop.ps1 | 17 -- Examples/Sample_xRegistryResource_AddKey.ps1 | 19 -- ...ple_xRegistryResource_AddOrModifyValue.ps1 | 27 --- .../Sample_xRegistryResource_RemoveKey.ps1 | 19 -- .../Sample_xRegistryResource_RemoveValue.ps1 | 19 -- Examples/Sample_xRemoteFile.ps1 | 50 ----- Examples/Sample_xRemoteFileUsingProxy.ps1 | 56 ----- .../Sample_xServiceSet_BuiltInAccount.ps1 | 20 -- Examples/Sample_xServiceSet_StartServices.ps1 | 18 -- Examples/Sample_xService_CreateService.ps1 | 24 --- Examples/Sample_xService_DeleteService.ps1 | 17 -- Examples/Sample_xUser_CreateUser.ps1 | 20 -- Examples/Sample_xUser_Generic.ps1 | 67 ------ Examples/Sample_xWindowsFeature.ps1 | 47 ----- .../Sample_xWindowsFeatureSet_Install.ps1 | 20 -- .../Sample_xWindowsFeatureSet_Uninstall.ps1 | 20 -- Examples/Sample_xWindowsOptionalFeature.ps1 | 39 ---- ...ple_xWindowsOptionalFeatureSet_Disable.ps1 | 16 -- ...mple_xWindowsOptionalFeatureSet_Enable.ps1 | 20 -- Examples/Sample_xWindowsPackageCab.ps1 | 50 ----- Examples/Sample_xWindowsProcess_Start.ps1 | 19 -- .../Sample_xWindowsProcess_StartUnderUser.ps1 | 37 ---- Examples/Sample_xWindowsProcess_Stop.ps1 | 20 -- .../Sample_xWindowsProcess_StopUnderUser.ps1 | 40 ---- ...ve_ExpandArchiveChecksumAndForceConfig.ps1 | 56 +++++ ...ArchiveDefaultValidationAndForceConfig.ps1 | 54 +++++ ...rchive_ExpandArchiveNoValidationConfig.ps1 | 45 ++++ ...andArchiveNoValidationCredentialConfig.ps1 | 59 ++++++ .../xArchive_RemoveArchiveChecksumConfig.ps1 | 49 +++++ ...rchive_RemoveArchiveNoValidationConfig.ps1 | 47 +++++ .../xEnvironment_AddMultiplePathsConfig.ps1 | 100 +++++++++ ...nvironment_CreateNonPathVariableConfig.ps1 | 94 +++++++++ ...xEnvironment_RemoveMultiplePathsConfig.ps1 | 97 +++++++++ .../xEnvironment_RemoveVariableConfig.ps1 | 79 +++++++ .../xFileUpload_UploadToSMBShareConfig.ps1 | 88 ++++++++ Examples/xGroupSet_AddMembersConfig.ps1 | 83 ++++++++ Examples/xGroup_RemoveMembersConfig.ps1 | 89 ++++++++ Examples/xGroup_SetMembersConfig.ps1 | 86 ++++++++ Examples/xMsiPackage_InstallPackageConfig.ps1 | 88 ++++++++ ...Package_UninstallPackageFromFileConfig.ps1 | 55 +++++ ...ackage_UninstallPackageFromHttpsConfig.ps1 | 56 +++++ Examples/xPSEndpoint_NewConfig.ps1 | 84 ++++++++ Examples/xPSEndpoint_NewCustomConfig.ps1 | 100 +++++++++ .../xPSEndpoint_NewWithDefaultsConfig.ps1 | 57 +++++ Examples/xPSEndpoint_RemoveConfig.ps1 | 56 +++++ ...llExeUsingCredentialsAndRegistryConfig.ps1 | 154 ++++++++++++++ ...ckage_InstallExeUsingCredentialsConfig.ps1 | 98 +++++++++ Examples/xPackage_InstallMsiConfig.ps1 | 66 ++++++ ...Package_InstallMsiUsingProductIdConfig.ps1 | 76 +++++++ Examples/xProcessSet_StartProcessConfig.ps1 | 66 ++++++ Examples/xProcessSet_StopProcessConfig.ps1 | 67 ++++++ Examples/xRegistryResource_AddKeyConfig.ps1 | 58 +++++ ...egistryResource_AddOrModifyValueConfig.ps1 | 127 +++++++++++ .../xRegistryResource_RemoveKeyConfig.ps1 | 57 +++++ .../xRegistryResource_RemoveValueConfig.ps1 | 64 ++++++ Examples/xRemoteFile_DownloadFileConfig.ps1 | 106 ++++++++++ ...emoteFile_DownloadFileUsingProxyConfig.ps1 | 117 ++++++++++ ...xServiceSet_EnsureBuiltInAccountConfig.ps1 | 51 +++++ Examples/xServiceSet_StartServicesConfig.ps1 | 65 ++++++ .../xService_ChangeServiceStateConfig.ps1 | 66 ++++++ Examples/xService_CreateServiceConfig.ps1 | 68 ++++++ Examples/xService_RemoveServiceConfig.ps1 | 56 +++++ Examples/xUser_CreateUserConfig.ps1 | 57 +++++ Examples/xUser_CreateUserDetailedConfig.ps1 | 127 +++++++++++ Examples/xUser_RemoveUserConfig.ps1 | 55 +++++ .../xWindowsFeatureSet_AddFeaturesConfig.ps1 | 73 +++++++ ...WindowsFeatureSet_RemoveFeaturesConfig.ps1 | 73 +++++++ Examples/xWindowsFeature_AddFeatureConfig.ps1 | 68 ++++++ ...eature_AddFeatureUsingCredentialConfig.ps1 | 76 +++++++ ...owsFeature_AddFeatureWithLogPathConfig.ps1 | 78 +++++++ .../xWindowsFeature_RemoveFeatureConfig.ps1 | 68 ++++++ ...indowsOptionalFeatureSet_DisableConfig.ps1 | 82 ++++++++ ...WindowsOptionalFeatureSet_EnableConfig.ps1 | 79 +++++++ .../xWindowsOptionalFeature_DisableConfig.ps1 | 71 +++++++ .../xWindowsOptionalFeature_EnableConfig.ps1 | 69 ++++++ ...WindowsPackageCab_InstallPackageConfig.ps1 | 78 +++++++ .../xWindowsProcess_StartProcessConfig.ps1 | 67 ++++++ ...owsProcess_StartProcessUnderUserConfig.ps1 | 88 ++++++++ .../xWindowsProcess_StopProcessConfig.ps1 | 72 +++++++ ...dowsProcess_StopProcessUnderUserConfig.ps1 | 88 ++++++++ README.md | 199 ++++++++++++++---- 106 files changed, 4414 insertions(+), 1535 deletions(-) delete mode 100644 Examples/Sample_InstallExeCredsRegistry_xPackage.ps1 delete mode 100644 Examples/Sample_InstallExeCreds_xPackage.ps1 delete mode 100644 Examples/Sample_InstallMSIProductId_xPackage.ps1 delete mode 100644 Examples/Sample_InstallMSI_xPackage.ps1 delete mode 100644 Examples/Sample_xArchive_ExpandArchiveChecksumAndForce.ps1 delete mode 100644 Examples/Sample_xArchive_ExpandArchiveDefaultValidationAndForce.ps1 delete mode 100644 Examples/Sample_xArchive_ExpandArchiveNoValidation.ps1 delete mode 100644 Examples/Sample_xArchive_ExpandArchiveNoValidationCredential.ps1 delete mode 100644 Examples/Sample_xArchive_RemoveArchiveChecksum.ps1 delete mode 100644 Examples/Sample_xArchive_RemoveArchiveNoValidation.ps1 delete mode 100644 Examples/Sample_xEnvironment_CreateMultiplePathVariables.ps1 delete mode 100644 Examples/Sample_xEnvironment_CreateNonPathVariable.ps1 delete mode 100644 Examples/Sample_xEnvironment_CreatePathVariable.ps1 delete mode 100644 Examples/Sample_xEnvironment_Remove.ps1 delete mode 100644 Examples/Sample_xEnvironment_RemovePathVariables.ps1 delete mode 100644 Examples/Sample_xFileUpload.ps1 delete mode 100644 Examples/Sample_xGroupSet_AddMembers.ps1 delete mode 100644 Examples/Sample_xGroup_RemoveMembers.ps1 delete mode 100644 Examples/Sample_xGroup_SetMembers.ps1 delete mode 100644 Examples/Sample_xMsiPackage_InstallPackageFromFile.ps1 delete mode 100644 Examples/Sample_xMsiPackage_InstallPackageFromHttp.ps1 delete mode 100644 Examples/Sample_xMsiPackage_UninstallPackageFromFile.ps1 delete mode 100644 Examples/Sample_xMsiPackage_UninstallPackageFromHttps.ps1 delete mode 100644 Examples/Sample_xPSSessionConfiguration.ps1 delete mode 100644 Examples/Sample_xProcessSet_Start.ps1 delete mode 100644 Examples/Sample_xProcessSet_Stop.ps1 delete mode 100644 Examples/Sample_xRegistryResource_AddKey.ps1 delete mode 100644 Examples/Sample_xRegistryResource_AddOrModifyValue.ps1 delete mode 100644 Examples/Sample_xRegistryResource_RemoveKey.ps1 delete mode 100644 Examples/Sample_xRegistryResource_RemoveValue.ps1 delete mode 100644 Examples/Sample_xRemoteFile.ps1 delete mode 100644 Examples/Sample_xRemoteFileUsingProxy.ps1 delete mode 100644 Examples/Sample_xServiceSet_BuiltInAccount.ps1 delete mode 100644 Examples/Sample_xServiceSet_StartServices.ps1 delete mode 100644 Examples/Sample_xService_CreateService.ps1 delete mode 100644 Examples/Sample_xService_DeleteService.ps1 delete mode 100644 Examples/Sample_xUser_CreateUser.ps1 delete mode 100644 Examples/Sample_xUser_Generic.ps1 delete mode 100644 Examples/Sample_xWindowsFeature.ps1 delete mode 100644 Examples/Sample_xWindowsFeatureSet_Install.ps1 delete mode 100644 Examples/Sample_xWindowsFeatureSet_Uninstall.ps1 delete mode 100644 Examples/Sample_xWindowsOptionalFeature.ps1 delete mode 100644 Examples/Sample_xWindowsOptionalFeatureSet_Disable.ps1 delete mode 100644 Examples/Sample_xWindowsOptionalFeatureSet_Enable.ps1 delete mode 100644 Examples/Sample_xWindowsPackageCab.ps1 delete mode 100644 Examples/Sample_xWindowsProcess_Start.ps1 delete mode 100644 Examples/Sample_xWindowsProcess_StartUnderUser.ps1 delete mode 100644 Examples/Sample_xWindowsProcess_Stop.ps1 delete mode 100644 Examples/Sample_xWindowsProcess_StopUnderUser.ps1 create mode 100644 Examples/xArchive_ExpandArchiveChecksumAndForceConfig.ps1 create mode 100644 Examples/xArchive_ExpandArchiveDefaultValidationAndForceConfig.ps1 create mode 100644 Examples/xArchive_ExpandArchiveNoValidationConfig.ps1 create mode 100644 Examples/xArchive_ExpandArchiveNoValidationCredentialConfig.ps1 create mode 100644 Examples/xArchive_RemoveArchiveChecksumConfig.ps1 create mode 100644 Examples/xArchive_RemoveArchiveNoValidationConfig.ps1 create mode 100644 Examples/xEnvironment_AddMultiplePathsConfig.ps1 create mode 100644 Examples/xEnvironment_CreateNonPathVariableConfig.ps1 create mode 100644 Examples/xEnvironment_RemoveMultiplePathsConfig.ps1 create mode 100644 Examples/xEnvironment_RemoveVariableConfig.ps1 create mode 100644 Examples/xFileUpload_UploadToSMBShareConfig.ps1 create mode 100644 Examples/xGroupSet_AddMembersConfig.ps1 create mode 100644 Examples/xGroup_RemoveMembersConfig.ps1 create mode 100644 Examples/xGroup_SetMembersConfig.ps1 create mode 100644 Examples/xMsiPackage_InstallPackageConfig.ps1 create mode 100644 Examples/xMsiPackage_UninstallPackageFromFileConfig.ps1 create mode 100644 Examples/xMsiPackage_UninstallPackageFromHttpsConfig.ps1 create mode 100644 Examples/xPSEndpoint_NewConfig.ps1 create mode 100644 Examples/xPSEndpoint_NewCustomConfig.ps1 create mode 100644 Examples/xPSEndpoint_NewWithDefaultsConfig.ps1 create mode 100644 Examples/xPSEndpoint_RemoveConfig.ps1 create mode 100644 Examples/xPackage_InstallExeUsingCredentialsAndRegistryConfig.ps1 create mode 100644 Examples/xPackage_InstallExeUsingCredentialsConfig.ps1 create mode 100644 Examples/xPackage_InstallMsiConfig.ps1 create mode 100644 Examples/xPackage_InstallMsiUsingProductIdConfig.ps1 create mode 100644 Examples/xProcessSet_StartProcessConfig.ps1 create mode 100644 Examples/xProcessSet_StopProcessConfig.ps1 create mode 100644 Examples/xRegistryResource_AddKeyConfig.ps1 create mode 100644 Examples/xRegistryResource_AddOrModifyValueConfig.ps1 create mode 100644 Examples/xRegistryResource_RemoveKeyConfig.ps1 create mode 100644 Examples/xRegistryResource_RemoveValueConfig.ps1 create mode 100644 Examples/xRemoteFile_DownloadFileConfig.ps1 create mode 100644 Examples/xRemoteFile_DownloadFileUsingProxyConfig.ps1 create mode 100644 Examples/xServiceSet_EnsureBuiltInAccountConfig.ps1 create mode 100644 Examples/xServiceSet_StartServicesConfig.ps1 create mode 100644 Examples/xService_ChangeServiceStateConfig.ps1 create mode 100644 Examples/xService_CreateServiceConfig.ps1 create mode 100644 Examples/xService_RemoveServiceConfig.ps1 create mode 100644 Examples/xUser_CreateUserConfig.ps1 create mode 100644 Examples/xUser_CreateUserDetailedConfig.ps1 create mode 100644 Examples/xUser_RemoveUserConfig.ps1 create mode 100644 Examples/xWindowsFeatureSet_AddFeaturesConfig.ps1 create mode 100644 Examples/xWindowsFeatureSet_RemoveFeaturesConfig.ps1 create mode 100644 Examples/xWindowsFeature_AddFeatureConfig.ps1 create mode 100644 Examples/xWindowsFeature_AddFeatureUsingCredentialConfig.ps1 create mode 100644 Examples/xWindowsFeature_AddFeatureWithLogPathConfig.ps1 create mode 100644 Examples/xWindowsFeature_RemoveFeatureConfig.ps1 create mode 100644 Examples/xWindowsOptionalFeatureSet_DisableConfig.ps1 create mode 100644 Examples/xWindowsOptionalFeatureSet_EnableConfig.ps1 create mode 100644 Examples/xWindowsOptionalFeature_DisableConfig.ps1 create mode 100644 Examples/xWindowsOptionalFeature_EnableConfig.ps1 create mode 100644 Examples/xWindowsPackageCab_InstallPackageConfig.ps1 create mode 100644 Examples/xWindowsProcess_StartProcessConfig.ps1 create mode 100644 Examples/xWindowsProcess_StartProcessUnderUserConfig.ps1 create mode 100644 Examples/xWindowsProcess_StopProcessConfig.ps1 create mode 100644 Examples/xWindowsProcess_StopProcessUnderUserConfig.ps1 diff --git a/Examples/Sample_InstallExeCredsRegistry_xPackage.ps1 b/Examples/Sample_InstallExeCredsRegistry_xPackage.ps1 deleted file mode 100644 index a0e13951c..000000000 --- a/Examples/Sample_InstallExeCredsRegistry_xPackage.ps1 +++ /dev/null @@ -1,81 +0,0 @@ -<# - Simple package that installs an .exe using credentials to access the installer and specifying RunAs Credentials. - This sample also uses custom registry data to discover the package. -#> -Configuration Example -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $Package, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $Source, - - [parameter(Mandatory = $true)] - [ValidateNotNull()] - [String] $ProductId, - - [boolean] $CreateCheckRegValue = $false, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $InstalledCheckRegKey, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $InstalledCheckRegValueName, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $InstalledCheckRegValueData, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [PSCredential] $Credential, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [PSCredential] $RunAsCredential, - - [parameter(Mandatory = $true)] - [ValidateNotNull()] - [String] $Arguments - ) - - Import-DscResource -ModuleName xPSDesiredStateConfiguration - - Node localhost - { - xPackage t1 - { - Ensure = "Present" - Name = $Package - Path = $Source - Arguments = $Arguments - RunAsCredential = $RunAsCredential - Credential = $Credential - ProductId = $ProductId - CreateCheckRegValue = $CreateCheckRegValue - InstalledCheckRegKey = $InstalledCheckRegKey - InstalledCheckRegValueName = $InstalledCheckRegValueName - InstalledCheckRegValueData = $InstalledCheckRegValueData - } - } -} - -<# -Sample use (parameter values need to be changed according to your scenario): -The reg key and value is created by xPacakage. - -# Create the MOF file using the configuration data -Sample -OutputPath $OutputPath -ConfigurationData $Global:AllNodes -Package "Package Name" -Source "\\software\installer.exe" ` - -InstalledCheckRegKey "SOFTWARE\Microsoft\DevDiv\winexpress\Servicing\12.0\coremsi" ` - -InstalledCheckRegValueName "Install" -InstalledCheckRegValueData "1" ` - -CreateCheckRegValue $true - -Credential $Credential -RunAsCredential $RunAsCredential ` - -Arguments "/q" -ProductId "" - -#> diff --git a/Examples/Sample_InstallExeCreds_xPackage.ps1 b/Examples/Sample_InstallExeCreds_xPackage.ps1 deleted file mode 100644 index 5cd884e5e..000000000 --- a/Examples/Sample_InstallExeCreds_xPackage.ps1 +++ /dev/null @@ -1,63 +0,0 @@ -<# -Simple package that installs an .exe using credentials to access the installer and specifying RunAs Credentials. - -#> - -Configuration Example -{ - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $PackageName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $SourcePath, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ProductId, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [PSCredential] - $Credential, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [PSCredential] - $RunAsCredential - ) - - - Import-DscResource -ModuleName xPSDesiredStateConfiguration - - Node localhost - { - xPackage t1 - { - Ensure = "Present" - Name = $PackageName - Path = $SourcePath - RunAsCredential = $RunAsCredential - Credential = $Credential - ProductId = $ProductId - } - } -} - - - -<# -Sample use (parameter values need to be changed according to your scenario): - -# Create the MOF file using the configuration data -Sample -OutputPath $OutputPath -ConfigurationData $Global:AllNodes -PackageName "Package Name" -SourcePath "\\software\installer.exe" -ProductId "" ` - -Credential $Credential -RunAsCredential $RunAsCredential - -#> - diff --git a/Examples/Sample_InstallMSIProductId_xPackage.ps1 b/Examples/Sample_InstallMSIProductId_xPackage.ps1 deleted file mode 100644 index 652898747..000000000 --- a/Examples/Sample_InstallMSIProductId_xPackage.ps1 +++ /dev/null @@ -1,42 +0,0 @@ -<# -Simple installer that installs an msi package and matches based on the product id. -#> -Configuration Example -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $PackageName, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $SourcePath, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $ProductId - ) - - Import-DscResource -ModuleName xPSDesiredStateConfiguration - - Node localhost - { - xPackage t1 - { - Ensure = "Present" - Name = $PackageName - Path = $SourcePath - ProductId = $ProductId - } - } -} - -<# -Sample use (parameter values need to be changed according to your scenario): - -# Create the MOF file using the configuration data -Sample -OutputPath $OutputPath -ConfigurationData $Global:AllNodes -PackageName "Package Name" -SourcePath "\\software\installer.msi" -ProductId "{F06FB2D7-C22C-4987-9545-7C3B15BBBD60}" - - -#> diff --git a/Examples/Sample_InstallMSI_xPackage.ps1 b/Examples/Sample_InstallMSI_xPackage.ps1 deleted file mode 100644 index 1f4815752..000000000 --- a/Examples/Sample_InstallMSI_xPackage.ps1 +++ /dev/null @@ -1,37 +0,0 @@ -<# -Simple installer for an msi package that matches via the Name. -#> -Configuration Example -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $PackageName, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $SourcePath - ) - - Import-DscResource -ModuleName xPSDesiredStateConfiguration - - Node localhost - { - xPackage t1 - { - Ensure = "Present" - Name = $PackageName - Path = $SourcePath - ProductId = "" - } - } -} - -<# -Sample use (parameter values need to be changed according to your scenario): - -# Create the MOF file using the configuration data -Sample -OutputPath $OutputPath -ConfigurationData $Global:AllNodes -PackageName "Package Name" -SourcePath "\\software\installer.msi" - -#> diff --git a/Examples/Sample_xArchive_ExpandArchiveChecksumAndForce.ps1 b/Examples/Sample_xArchive_ExpandArchiveChecksumAndForce.ps1 deleted file mode 100644 index d7efc7839..000000000 --- a/Examples/Sample_xArchive_ExpandArchiveChecksumAndForce.ps1 +++ /dev/null @@ -1,30 +0,0 @@ -<# - .SYNOPSIS - Expands the archive located at 'C:\ExampleArchivePath\Archive.zip' to the destination path - 'C:\ExampleDestinationPath\Destination'. - - Since Validate is specified as $true and the Checksum parameter is specified as SHA-256, the - resource will check if the SHA-256 hash of the file in the archive matches the SHA-256 hash - of the corresponding file at the destination and replace any files that do not match. - - Since Force is specified as $true, the resource will overwrite any mismatching files at the - destination. If Force is specified as $false, the resource will throw an error instead of - overwrite any files at the destination. -#> -Configuration Sample_xArchive_ExpandArchiveChecksumAndForce -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xArchive Archive4 - { - Path = 'C:\ExampleArchivePath\Archive.zip' - Destination = 'C:\ExampleDestinationPath\Destination' - Validate = $true - Checksum = 'SHA-256' - Force = $true - Ensure = 'Present' - } - } -} diff --git a/Examples/Sample_xArchive_ExpandArchiveDefaultValidationAndForce.ps1 b/Examples/Sample_xArchive_ExpandArchiveDefaultValidationAndForce.ps1 deleted file mode 100644 index ec13c4519..000000000 --- a/Examples/Sample_xArchive_ExpandArchiveDefaultValidationAndForce.ps1 +++ /dev/null @@ -1,29 +0,0 @@ -<# - .SYNOPSIS - Expands the archive located at 'C:\ExampleArchivePath\Archive.zip' to the destination path - 'C:\ExampleDestinationPath\Destination'. - - Since Validate is specified as $true and the Checksum parameter is not provided, the - resource will check if the last write time of the archive file matches the last write time - of the corresponding file at the destination and replace any files that do not match. - - Since Force is specified as $true, the resource will overwrite any mismatching files at the - destination. If Force is specified as $false, the resource will throw an error instead of - overwrite any files at the destination. -#> -Configuration Sample_xArchive_ExpandArchiveDefaultValidationAndForce -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xArchive Archive3 - { - Path = 'C:\ExampleArchivePath\Archive.zip' - Destination = 'C:\ExampleDestinationPath\Destination' - Validate = $true - Force = $true - Ensure = 'Present' - } - } -} diff --git a/Examples/Sample_xArchive_ExpandArchiveNoValidation.ps1 b/Examples/Sample_xArchive_ExpandArchiveNoValidation.ps1 deleted file mode 100644 index 5d6382b47..000000000 --- a/Examples/Sample_xArchive_ExpandArchiveNoValidation.ps1 +++ /dev/null @@ -1,23 +0,0 @@ -<# - .SYNOPSIS - Expands the archive located at 'C:\ExampleArchivePath\Archive.zip' to the destination path - 'C:\ExampleDestinationPath\Destination'. - - The resource will only check if the expanded archive files exist at the destination. - No validation is performed on any existing files at the destination to ensure that they - match the files in the archive. -#> -Configuration Sample_xArchive_ExpandArchiveNoValidation -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xArchive Archive1 - { - Path = 'C:\ExampleArchivePath\Archive.zip' - Destination = 'C:\ExampleDestinationPath\Destination' - Ensure = 'Present' - } - } -} diff --git a/Examples/Sample_xArchive_ExpandArchiveNoValidationCredential.ps1 b/Examples/Sample_xArchive_ExpandArchiveNoValidationCredential.ps1 deleted file mode 100644 index 42a132f87..000000000 --- a/Examples/Sample_xArchive_ExpandArchiveNoValidationCredential.ps1 +++ /dev/null @@ -1,35 +0,0 @@ -<# - .SYNOPSIS - Expands the archive located at 'C:\ExampleArchivePath\Archive.zip' to the destination path - 'C:\ExampleDestinationPath\Destination'. - - The added specification of a Credential here allows you to provide the credential of a user - to provide the resource access to the archive and destination paths. - - The resource will only check if the expanded archive files exist at the destination. - No validation is performed on any existing files at the destination to ensure that they - match the files in the archive. -#> -Configuration Sample_xArchive_ExpandArchiveNoValidationCredential -{ - param - ( - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xArchive Archive2 - { - Path = 'C:\ExampleArchivePath\Archive.zip' - Destination = 'C:\ExampleDestinationPath\Destination' - Credential = $Credential - Ensure = 'Present' - } - } -} diff --git a/Examples/Sample_xArchive_RemoveArchiveChecksum.ps1 b/Examples/Sample_xArchive_RemoveArchiveChecksum.ps1 deleted file mode 100644 index b92469c5f..000000000 --- a/Examples/Sample_xArchive_RemoveArchiveChecksum.ps1 +++ /dev/null @@ -1,25 +0,0 @@ -<# - .SYNOPSIS - Remove the expansion of the archive located at 'C:\ExampleArchivePath\Archive.zip' from the - destination path 'C:\ExampleDestinationPath\Destination'. - - Since Validate is specified as $true and the Checksum parameter is specified as SHA-256, the - resource will check if the SHA-256 hash of the file in the archive matches the SHA-256 hash - of the corresponding file at the destination and will not remove any files that do not match. -#> -Configuration Sample_xArchive_RemoveArchiveChecksum -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xArchive Archive6 - { - Path = 'C:\ExampleArchivePath\Archive.zip' - Destination = 'C:\ExampleDestinationPath\Destination' - Validate = $true - Checksum = 'SHA-256' - Ensure = 'Absent' - } - } -} diff --git a/Examples/Sample_xArchive_RemoveArchiveNoValidation.ps1 b/Examples/Sample_xArchive_RemoveArchiveNoValidation.ps1 deleted file mode 100644 index 506b9f209..000000000 --- a/Examples/Sample_xArchive_RemoveArchiveNoValidation.ps1 +++ /dev/null @@ -1,23 +0,0 @@ -<# - .SYNOPSIS - Removes the expansion of the archive located at 'C:\ExampleArchivePath\Archive.zip' from the - destination path 'C:\ExampleDestinationPath\Destination'. - - The resource will only check if the expanded archive files exist at the destination. - No validation is performed on any existing files at the destination to ensure that they - match the files in the archive before removing them. -#> -Configuration Sample_xArchive_RemoveArchiveNoValidation -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xArchive Archive5 - { - Path = 'C:\ExampleArchivePath\Archive.zip' - Destination = 'C:\ExampleDestinationPath\Destination' - Ensure = 'Absent' - } - } -} diff --git a/Examples/Sample_xEnvironment_CreateMultiplePathVariables.ps1 b/Examples/Sample_xEnvironment_CreateMultiplePathVariables.ps1 deleted file mode 100644 index 63ba2c6da..000000000 --- a/Examples/Sample_xEnvironment_CreateMultiplePathVariables.ps1 +++ /dev/null @@ -1,24 +0,0 @@ -<# - .SYNOPSIS - Ensures that the 'TestPathEnvironmentVariable' environment variable exists and that - its value includes both "C:\test123" and "C:\test456". If one or both of these values do not exist - in the environment variable, they will be appended without modifying any preexisting values. - In this example changes are made to both the machine and the process. - -#> -Configuration Sample_xEnvironment_CreateMultiplePathVariables -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xEnvironment CreateMultiplePathEnvironmentVariables - { - Name = 'TestPathEnvironmentVariable' - Value = 'C:\test123;C:\test456;C:\test789' - Ensure = 'Present' - Path = $true - Target = @('Process', 'Machine') - } - } -} diff --git a/Examples/Sample_xEnvironment_CreateNonPathVariable.ps1 b/Examples/Sample_xEnvironment_CreateNonPathVariable.ps1 deleted file mode 100644 index 213acadcf..000000000 --- a/Examples/Sample_xEnvironment_CreateNonPathVariable.ps1 +++ /dev/null @@ -1,21 +0,0 @@ -<# - .SYNOPSIS - Creates the environment variable 'TestEnvironmentVariable' and sets the value to 'TestValue' - both on the machine and within the process. -#> -Configuration Sample_xEnvironment_CreateNonPathVariable -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xEnvironment CreateEnvironmentVariable - { - Name = 'TestEnvironmentVariable' - Value = 'TestValue' - Ensure = 'Present' - Path = $false - Target = @('Process', 'Machine') - } - } -} diff --git a/Examples/Sample_xEnvironment_CreatePathVariable.ps1 b/Examples/Sample_xEnvironment_CreatePathVariable.ps1 deleted file mode 100644 index 77be10a11..000000000 --- a/Examples/Sample_xEnvironment_CreatePathVariable.ps1 +++ /dev/null @@ -1,22 +0,0 @@ -<# - .SYNOPSIS - Creates the environment variable 'TestPathEnvironmentVariable' and sets the value to 'TestValue' - if it doesn't already exist or appends the value 'TestValue' to the existing path if it does - already exist on the machine and within the process. -#> -Configuration Sample_xEnvironment_CreatePathVariable -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xEnvironment CreatePathEnvironmentVariable - { - Name = 'TestPathEnvironmentVariable' - Value = 'TestValue' - Ensure = 'Present' - Path = $true - Target = @('Process', 'Machine') - } - } -} diff --git a/Examples/Sample_xEnvironment_Remove.ps1 b/Examples/Sample_xEnvironment_Remove.ps1 deleted file mode 100644 index c73060039..000000000 --- a/Examples/Sample_xEnvironment_Remove.ps1 +++ /dev/null @@ -1,20 +0,0 @@ -<# - .SYNOPSIS - Removes the environment variable 'TestEnvironmentVariable' from - both the machine and the process. -#> -Configuration Sample_xEnvironment_Remove -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xEnvironment RemoveEnvironmentVariable - { - Name = 'TestEnvironmentVariable' - Ensure = 'Absent' - Path = $false - Target = @('Process', 'Machine') - } - } -} diff --git a/Examples/Sample_xEnvironment_RemovePathVariables.ps1 b/Examples/Sample_xEnvironment_RemovePathVariables.ps1 deleted file mode 100644 index f790075b3..000000000 --- a/Examples/Sample_xEnvironment_RemovePathVariables.ps1 +++ /dev/null @@ -1,23 +0,0 @@ -<# - .SYNOPSIS - Removes one or more values from the 'TestPathEnvironmentVariable' environment variable if the values exist. - Other values of the 'TestPathEnvironmentVariable' environment variable will not be modified. In this - example, the values 'C:\test456' and 'C:\test123' will be removed, but all other entries - will be left intact. In this example changes are made to applied the machine and the process. -#> -Configuration Sample_xEnvironment_RemovePathVariables -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xEnvironment RemovePathEnvironmentVariables - { - Name = 'TestPathEnvironmentVariable' - Ensure = 'Absent' - Path = $true - Value = "C:\test456;C;\test123" - Target = @('Process', 'Machine') - } - } -} diff --git a/Examples/Sample_xFileUpload.ps1 b/Examples/Sample_xFileUpload.ps1 deleted file mode 100644 index 04d40b86a..000000000 --- a/Examples/Sample_xFileUpload.ps1 +++ /dev/null @@ -1,36 +0,0 @@ -Configuration Sample_xFileUpload -{ - param ( - [parameter(Mandatory = $true)] - [String] - $destinationPath, - - [parameter(Mandatory = $true)] - [String] - $sourcePath, - - [PSCredential] $credential, - [String] - $certificateThumbprint - ) - - Import-DscResource -modulename xPSDesiredStateConfiguration - - node localhost - { - xFileUpload fileUpload - { - destinationPath = $destinationPath - sourcePath = $sourcePath - credential = $credential - certificateThumbprint = $certificateThumbprint - } - } -} - -#Sample use (please change values of parameters according to your scenario): - -#$credential = New-Object System.Management.Automation.PSCredential -ArgumentList "domain\user", (ConvertTo-SecureString -String "password" -AsPlainText -Force) -#$certificateThumbprint = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" -#FileUploadConfiguration -destinationPath "\\machinename\folder" -sourcePath "C:\folder\file.txt" -credential $credential -certificateThumbprint $certificateThumbprint -#Start-DscConfiguration -Path .\FileUploadConfiguration -wait -verbose -debug diff --git a/Examples/Sample_xGroupSet_AddMembers.ps1 b/Examples/Sample_xGroupSet_AddMembers.ps1 deleted file mode 100644 index 13c6be706..000000000 --- a/Examples/Sample_xGroupSet_AddMembers.ps1 +++ /dev/null @@ -1,20 +0,0 @@ -<# - .SYNOPSIS - If the groups named GroupName1 and Administrators do not exist, creates the groups named - GroupName1 and Administrators and adds the users with the usernames Username1 and Username2 - to both groups. - - If the groups named GroupName1 and Administrators already exist, adds the users with the - usernames Username1 and Username2 to both groups. -#> -Configuration Sample_xGroupSet_AddMembers -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - xGroupSet GroupSet - { - GroupName = @( 'Administrators', 'GroupName1' ) - Ensure = 'Present' - MembersToInclude = @( 'Username1', 'Username2' ) - } -} diff --git a/Examples/Sample_xGroup_RemoveMembers.ps1 b/Examples/Sample_xGroup_RemoveMembers.ps1 deleted file mode 100644 index fe7653612..000000000 --- a/Examples/Sample_xGroup_RemoveMembers.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -<# - .SYNOPSIS - If the group named GroupName1 does not exist, creates a group named GroupName1. - - If the group named GroupName1 already exists removes the users that have the usernames - Username1 or Username2 from the group. -#> -Configuration Sample_xGroup_RemoveMembers -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - xGroup Group1 - { - GroupName = 'GroupName1' - Ensure = 'Present' - MembersToExclude = @( 'Username1', 'Username2' ) - } -} diff --git a/Examples/Sample_xGroup_SetMembers.ps1 b/Examples/Sample_xGroup_SetMembers.ps1 deleted file mode 100644 index 9f2fc274f..000000000 --- a/Examples/Sample_xGroup_SetMembers.ps1 +++ /dev/null @@ -1,20 +0,0 @@ -<# - .SYNOPSIS - If the group named GroupName1 does not exist, creates a group named GroupName1 and adds the - users with the usernames Username1 and Username2 to the group. - - If the group named GroupName1 already exists, removes any users that do not have the - usernames Username1 or Username2 from the group and adds the users that have the usernames - Username1 and Username2 to the group. -#> -Configuration Sample_xGroup_SetMembers -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - xGroup Group1 - { - GroupName = 'GroupName1' - Ensure = 'Present' - Members = @( 'Username1', 'Username2' ) - } -} diff --git a/Examples/Sample_xMsiPackage_InstallPackageFromFile.ps1 b/Examples/Sample_xMsiPackage_InstallPackageFromFile.ps1 deleted file mode 100644 index 898c7cf41..000000000 --- a/Examples/Sample_xMsiPackage_InstallPackageFromFile.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -<# - .SYNOPSIS - Installs the MSI file with the product ID: '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' - at the path: 'file://Examples/example.msi'. - - Note that the MSI file with the given product ID must already exist at the specified path. - The product ID and path value in this file are provided for example purposes only and will - need to be replaced with valid values. - - You can run the following command to get a list of all available MSIs on - your system with the correct Path (LocalPackage) and product ID (IdentifyingNumber): - - Get-WmiObject Win32_Product | Format-Table IdentifyingNumber, Name, LocalPackage -#> -Configuration Sample_xMsiPackage_InstallPackageFromFile -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xMsiPackage MsiPackage1 - { - ProductId = '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' - Path = 'file://Examples/example.msi' - Ensure = 'Present' - } - } -} diff --git a/Examples/Sample_xMsiPackage_InstallPackageFromHttp.ps1 b/Examples/Sample_xMsiPackage_InstallPackageFromHttp.ps1 deleted file mode 100644 index b4748eb89..000000000 --- a/Examples/Sample_xMsiPackage_InstallPackageFromHttp.ps1 +++ /dev/null @@ -1,23 +0,0 @@ -<# - .SYNOPSIS - Installs the MSI file with the product ID: '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' - at the path: 'http://Examples/example.msi'. - - Note that the MSI file with the given product ID must already exist on the server. - The product ID and path value in this file are provided for example purposes only and will - need to be replaced with valid values. -#> -Configuration Sample_xMsiPackage_InstallPackageFromHttp -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xMsiPackage MsiPackage1 - { - ProductId = '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' - Path = 'http://Examples/example.msi' - Ensure = 'Present' - } - } -} diff --git a/Examples/Sample_xMsiPackage_UninstallPackageFromFile.ps1 b/Examples/Sample_xMsiPackage_UninstallPackageFromFile.ps1 deleted file mode 100644 index 8346b8c65..000000000 --- a/Examples/Sample_xMsiPackage_UninstallPackageFromFile.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -<# - .SYNOPSIS - Uninstalls the MSI file with the product ID: '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' - at the path: 'file://Examples/example.msi'. - - Note that the MSI file with the given product ID must already exist at the specified path. - The product ID and path value in this file are provided for example purposes only and will - need to be replaced with valid values. - - You can run the following command to get a list of all available MSIs on - your system with the correct Path (LocalPackage) and product ID (IdentifyingNumber): - - Get-WmiObject Win32_Product | Format-Table IdentifyingNumber, Name, LocalPackage -#> -Configuration Sample_xMsiPackage_UninstallPackageFromFile -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xMsiPackage MsiPackage1 - { - ProductId = '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' - Path = 'file://Examples/example.msi' - Ensure = 'Absent' - } - } -} diff --git a/Examples/Sample_xMsiPackage_UninstallPackageFromHttps.ps1 b/Examples/Sample_xMsiPackage_UninstallPackageFromHttps.ps1 deleted file mode 100644 index cf213f19b..000000000 --- a/Examples/Sample_xMsiPackage_UninstallPackageFromHttps.ps1 +++ /dev/null @@ -1,23 +0,0 @@ -<# - .SYNOPSIS - Uninstalls the MSI file with the product ID: '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' - at the path: 'https://Examples/example.msi'. - - Note that the MSI file with the given product ID must already exist on the server. - The product ID and path value in this file are provided for example purposes only and will - need to be replaced with valid values. -#> -Configuration Sample_xMsiPackage_UninstallPackageFromHttps -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xMsiPackage MsiPackage1 - { - ProductId = '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' - Path = 'https://Examples/example.msi' - Ensure = 'Absent' - } - } -} diff --git a/Examples/Sample_xPSSessionConfiguration.ps1 b/Examples/Sample_xPSSessionConfiguration.ps1 deleted file mode 100644 index 433170077..000000000 --- a/Examples/Sample_xPSSessionConfiguration.ps1 +++ /dev/null @@ -1,87 +0,0 @@ -<# - .SYNOPSIS - Creates a new xPSEndpoint using default values. -#> -configuration Example # Sample_xPSEndpoint_NewWithDefaults -{ - param - ( - [Parameter(Mandatory)] - [String] - $Name - ) - - Import-DscResource -module xPSDesiredStateConfiguration - - xPSEndpoint PSSessionConfiguration - { - Name = $Name - Ensure = 'Present' - } -} - -configuration Sample_xPSEndpoint_LocalOnlyWorkflowEP -{ - Import-DscResource -module xPSDesiredStateConfiguration - - xPSEndpoint PSSessionConfiguration - { - Name = 'Microsoft.PowerShell.Workflow' - Ensure = 'Present' - AccessMode = 'Disabled' - } -} - -configuration Sample_xPSEndpoint_RemoveEP -{ - param - ( - [Parameter(Mandatory)] - [String] - $Name - ) - Import-DscResource -module xPSDesiredStateConfiguration - - xPSEndpoint PSSessionConfiguration - { - Name = $Name - Ensure = 'Absent' - } -} - -configuration Sample_xPSEndpoint_NewWithRunAsandStartupAndCustomSDDLAndLocalAccess -{ - param - ( - [Parameter(Mandatory)] - [String] - $Name, - - [Parameter(Mandatory)] - [PSCredential] - $RunAs, - - [String] - $SDDL = 'Default', - - [Parameter(Mandatory)] - [String] - $StartupScript - ) - Import-DscResource -module xPSDesiredStateConfiguration - - Node 'localhost' - { - xPSEndpoint PSSessionConfiguration - { - Name = $Name - Ensure = 'Present' - AccessMode = 'Local' - RunAsCredential = $RunAs - SecurityDescriptorSDDL = $SDDL - StartupScript = $StartupScript - } - } -} - -# To use the sample(s) with credentials, see blog at http://blogs.msdn.com/b/powershell/archive/2014/01/31/want-to-secure-credentials-in-windows-powershell-desired-state-configuration.aspx diff --git a/Examples/Sample_xProcessSet_Start.ps1 b/Examples/Sample_xProcessSet_Start.ps1 deleted file mode 100644 index 6d34e9182..000000000 --- a/Examples/Sample_xProcessSet_Start.ps1 +++ /dev/null @@ -1,15 +0,0 @@ -<# - .SYNOPSIS - Starts the processes with the executables at the file paths C:\Windows\cmd.exe and - C:\TestPath\TestProcess.exe with no arguments. -#> -Configuration Sample_xProcessSet_Start -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - xProcessSet xProcessSet1 - { - Path = @( 'C:\Windows\System32\cmd.exe', 'C:\TestPath\TestProcess.exe' ) - Ensure = 'Present' - } -} diff --git a/Examples/Sample_xProcessSet_Stop.ps1 b/Examples/Sample_xProcessSet_Stop.ps1 deleted file mode 100644 index a31e618d6..000000000 --- a/Examples/Sample_xProcessSet_Stop.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -<# - .SYNOPSIS - Stops the processes with the executables at the file paths C:\Windows\cmd.exe and - C:\TestPath\TestProcess.exe with no arguments and logs any output to the path - C:\OutputPath\Output.log. -#> -Configuration Sample_xProcessSet_Stop -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - xProcessSet xProcessSet1 - { - Path = @( 'C:\Windows\System32\cmd.exe', 'C:\TestPath\TestProcess.exe' ) - Ensure = 'Absent' - StandardOutputPath = 'C:\OutputPath\Output.log' - } -} diff --git a/Examples/Sample_xRegistryResource_AddKey.ps1 b/Examples/Sample_xRegistryResource_AddKey.ps1 deleted file mode 100644 index ad69eb571..000000000 --- a/Examples/Sample_xRegistryResource_AddKey.ps1 +++ /dev/null @@ -1,19 +0,0 @@ -<# - .SYNOPSIS - Create a new registry key called MyNewKey as a subkey under the key - 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'. -#> -Configuration Sample_xRegistryResource_AddKey -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xRegistry Registry1 - { - Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\MyNewKey' - Ensure = 'Present' - ValueName = '' - } - } -} diff --git a/Examples/Sample_xRegistryResource_AddOrModifyValue.ps1 b/Examples/Sample_xRegistryResource_AddOrModifyValue.ps1 deleted file mode 100644 index d9c038959..000000000 --- a/Examples/Sample_xRegistryResource_AddOrModifyValue.ps1 +++ /dev/null @@ -1,27 +0,0 @@ -<# - .SYNOPSIS - If the registry key value MyValue under the key - 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' does not exist, - creates it with the Binary value 0. - - If the registry key value MyValue under the key - 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' already exists, - overwrites it with the Binary value 0. -#> -Configuration Sample_xRegistryResource_AddOrModifyValue -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xRegistry Registry1 - { - Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' - Ensure = 'Present' - ValueName = 'MyValue' - ValueType = 'Binary' - ValueData = '0x00' - Force = $true - } - } -} diff --git a/Examples/Sample_xRegistryResource_RemoveKey.ps1 b/Examples/Sample_xRegistryResource_RemoveKey.ps1 deleted file mode 100644 index 7e7e9d6dd..000000000 --- a/Examples/Sample_xRegistryResource_RemoveKey.ps1 +++ /dev/null @@ -1,19 +0,0 @@ -<# - .SYNOPSIS - Removes the registry key called MyNewKey under the parent key - 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'. -#> -Configuration Sample_xRegistryResource_RemoveKey -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xRegistry Registry1 - { - Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\MyNewKey' - Ensure = 'Absent' - ValueName = '' - } - } -} diff --git a/Examples/Sample_xRegistryResource_RemoveValue.ps1 b/Examples/Sample_xRegistryResource_RemoveValue.ps1 deleted file mode 100644 index c274335f2..000000000 --- a/Examples/Sample_xRegistryResource_RemoveValue.ps1 +++ /dev/null @@ -1,19 +0,0 @@ -<# - .SYNOPSIS - Removes the registry key value MyValue from the key - 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'. -#> -Configuration Sample_xRegistryResource_RemoveValue -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xRegistry Registry1 - { - Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' - Ensure = 'Absent' - ValueName = 'MyValue' - } - } -} diff --git a/Examples/Sample_xRemoteFile.ps1 b/Examples/Sample_xRemoteFile.ps1 deleted file mode 100644 index d0e6c5a23..000000000 --- a/Examples/Sample_xRemoteFile.ps1 +++ /dev/null @@ -1,50 +0,0 @@ -<# - .EXAMPLE - Sample_xRemoteFile_DownloadFile -#> -configuration Sample_xRemoteFile -{ - param - ( - [string[]] - $nodeName = 'localhost', - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $destinationPath, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $uri, - - [String] - $userAgent, - - [Hashtable] - $headers - ) - - Import-DscResource -Name MSFT_xRemoteFile -ModuleName xPSDesiredStateConfiguration - - Node $nodeName - { - xRemoteFile DownloadFile - { - DestinationPath = $destinationPath - Uri = $uri - UserAgent = $userAgent - Headers = $headers - } - } -} - -<# -Sample use (parameter values need to be changed according to your scenario): - -Sample_xRemoteFile_DownloadFile -destinationPath "$env:SystemDrive\fileName.jpg" -uri "http://www.contoso.com/image.jpg" - -Sample_xRemoteFile_DownloadFile -destinationPath "$env:SystemDrive\fileName.jpg" -uri "http://www.contoso.com/image.jpg" ` --userAgent [Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer -headers @{"Accept-Language" = "en-US"} -#> diff --git a/Examples/Sample_xRemoteFileUsingProxy.ps1 b/Examples/Sample_xRemoteFileUsingProxy.ps1 deleted file mode 100644 index d0908ce61..000000000 --- a/Examples/Sample_xRemoteFileUsingProxy.ps1 +++ /dev/null @@ -1,56 +0,0 @@ -configuration Sample_xRemoteFileUsingProxy -{ - param - ( - [string[]] - $nodeName = 'localhost', - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $destinationPath, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $uri, - - [String] - $userAgent, - - [Hashtable] - $headers, - - [String] - $proxy - ) - - Import-DscResource -Name MSFT_xRemoteFile -ModuleName xPSDesiredStateConfiguration - - Node $nodeName - { - xRemoteFile DownloadFile - { - DestinationPath = $destinationPath - Uri = $uri - UserAgent = $userAgent - Headers = $headers - Proxy = $proxy - } - } -} - -<# -Sample use (parameter values need to be changed according to your scenario): - -Sample_xRemoteFile_DownloadFileUsingProxy ` - -destinationPath "$env:SystemDrive\fileName.jpg" ` - -uri "http://www.contoso.com/image.jpg" - -Sample_xRemoteFile_DownloadFileUsingProxy ` - -destinationPath "$env:SystemDrive\fileName.jpg" ` - -uri "http://www.contoso.com/image.jpg" ` - -userAgent [Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer ` - -headers @{"Accept-Language" = "en-US"} ` - -proxy 'http://10.22.93.1' -#> diff --git a/Examples/Sample_xServiceSet_BuiltInAccount.ps1 b/Examples/Sample_xServiceSet_BuiltInAccount.ps1 deleted file mode 100644 index 7fe55fb96..000000000 --- a/Examples/Sample_xServiceSet_BuiltInAccount.ps1 +++ /dev/null @@ -1,20 +0,0 @@ -<# - .SYNOPSIS - Sets the Secure Socket Tunneling Protocol and DHCP Client services to run under the - built-in account LocalService. -#> -Configuration Sample_xServiceSet_BuiltInAccount -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xServiceSet ServiceSet1 - { - Name = @( 'SstpSvc', 'Dhcp' ) - Ensure = 'Present' - BuiltInAccount = 'LocalService' - State = 'Ignore' - } - } -} diff --git a/Examples/Sample_xServiceSet_StartServices.ps1 b/Examples/Sample_xServiceSet_StartServices.ps1 deleted file mode 100644 index 7a9914157..000000000 --- a/Examples/Sample_xServiceSet_StartServices.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -<# - .SYNOPSIS - Ensures that the DHCP Client and Windows Firewall services are running. -#> -Configuration Sample_xServiceSet_StartServices -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xServiceSet ServiceSet1 - { - Name = @( 'Dhcp', 'MpsSvc' ) - Ensure = 'Present' - State = 'Running' - } - } -} diff --git a/Examples/Sample_xService_CreateService.ps1 b/Examples/Sample_xService_CreateService.ps1 deleted file mode 100644 index 5c8f74248..000000000 --- a/Examples/Sample_xService_CreateService.ps1 +++ /dev/null @@ -1,24 +0,0 @@ -<# - .SYNOPSIS - If the service with the name Service1 does not exist, creates the service with the name - Service1 and the executable/binary path 'C:\FilePath\MyServiceExecutable.exe'. The new - service will be started by default. - - If the service with the name Service1 already exists, sets executable/binary path of the - service with the name Service1 to 'C:\FilePath\MyServiceExecutable.exe' and starts the - service by default if it is not running already. -#> -Configuration Sample_xService_CreateService -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xService ServiceResource1 - { - Name = 'Service1' - Ensure = 'Present' - Path = 'C:\FilePath\MyServiceExecutable.exe' - } - } -} diff --git a/Examples/Sample_xService_DeleteService.ps1 b/Examples/Sample_xService_DeleteService.ps1 deleted file mode 100644 index 8c068a90a..000000000 --- a/Examples/Sample_xService_DeleteService.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -<# - .SYNOPSIS - Stops and then removes the service with the name Service1. -#> -Configuration Sample_xService_DeleteService -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xService ServiceResource1 - { - Name = 'Service1' - Ensure = 'Absent' - } - } -} diff --git a/Examples/Sample_xUser_CreateUser.ps1 b/Examples/Sample_xUser_CreateUser.ps1 deleted file mode 100644 index 387241f54..000000000 --- a/Examples/Sample_xUser_CreateUser.ps1 +++ /dev/null @@ -1,20 +0,0 @@ -Configuration Sample_xUser_CreateUser -{ - param - ( - [System.Management.Automation.PSCredential] - $PasswordCredential - ) - - Import-DscResource -ModuleName xPSDesiredStateConfiguration - - Node localhost - { - xUser xUserExample - { - Ensure = 'Present' # To ensure the user account does not exist, set Ensure to "Absent" - UserName = 'SomeUserName' - Password = $PasswordCredential # This needs to be a credential object - } - } -} diff --git a/Examples/Sample_xUser_Generic.ps1 b/Examples/Sample_xUser_Generic.ps1 deleted file mode 100644 index 428eb7cd4..000000000 --- a/Examples/Sample_xUser_Generic.ps1 +++ /dev/null @@ -1,67 +0,0 @@ -param -( - [Parameter()] - [System.String] - $ConfigurationName = 'Sample_xUser_Generic' -) - -<# - Create a custom configuration by passing in whatever - values you need. $Password is the only param that is - required since it must be a PSCredential object. - If you want to create a user with minimal attributes, - every param except username can be deleted since they - are optional. -#> -Configuration $ConfigurationName -{ - param - ( - [System.String] - $UserName = 'Test UserName', - - [System.String] - $Description = 'Test Description', - - [System.String] - $FullName = 'Test Full Name', - - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Password, - - [System.Boolean] - $Disabled = $false, - - [System.Boolean] - $PasswordNeverExpires = $false, - - [System.Boolean] - $PasswordChangeRequired = $false, - - [System.Boolean] - $PasswordChangeNotAllowed = $false - ) - - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xUser UserResource1 - { - UserName = $UserName - Ensure = $Ensure - FullName = $FullName - Description = $Description - Password = $Password - Disabled = $Disabled - PasswordNeverExpires = $PasswordNeverExpires - PasswordChangeRequired = $PasswordChangeRequired - PasswordChangeNotAllowed = $PasswordChangeNotAllowed - } - } -} diff --git a/Examples/Sample_xWindowsFeature.ps1 b/Examples/Sample_xWindowsFeature.ps1 deleted file mode 100644 index 0999adae6..000000000 --- a/Examples/Sample_xWindowsFeature.ps1 +++ /dev/null @@ -1,47 +0,0 @@ -<# - Create a custom configuration by passing in whatever values you need. - $Name is the only parameter that is required which indicates which - Windows Feature you want to install (or uninstall if you set Ensure to Absent). - LogPath and Credential are not included here, but if you would like to specify - a custom log path or need a credential just pass in the desired values and add - LogPath = $LogPath and/or Credential = $Credential to the configuration here - - .EXAMPLE - Install_Feature_Telnet_Client -#> -Configuration Sample_xWindowsFeature -{ - param - ( - [System.String] - $Name = 'Telnet-Client', - - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [System.Boolean] - $IncludeAllSubFeature = $false, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [ValidateNotNullOrEmpty()] - [System.String] - $LogPath - ) - - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xWindowsFeature WindowsFeatureTest - { - Name = $Name - Ensure = $Ensure - IncludeAllSubFeature = $IncludeAllSubFeature - } - } -} - diff --git a/Examples/Sample_xWindowsFeatureSet_Install.ps1 b/Examples/Sample_xWindowsFeatureSet_Install.ps1 deleted file mode 100644 index dc4e60374..000000000 --- a/Examples/Sample_xWindowsFeatureSet_Install.ps1 +++ /dev/null @@ -1,20 +0,0 @@ -<# - .SYNOPSIS - Installs the TelnetClient and RSAT-File-Services Windows features, including all their - subfeatures. Logs the operation to the file at 'C:\LogPath\Log.log'. -#> -Configuration Sample_xWindowsFeatureSet_Install -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xWindowsFeatureSet WindowsFeatureSet1 - { - Name = @( 'Telnet-Client', 'RSAT-File-Services' ) - Ensure = 'Present' - IncludeAllSubFeature = $true - LogPath = 'C:\LogPath\Log.log' - } - } -} diff --git a/Examples/Sample_xWindowsFeatureSet_Uninstall.ps1 b/Examples/Sample_xWindowsFeatureSet_Uninstall.ps1 deleted file mode 100644 index 079a005c4..000000000 --- a/Examples/Sample_xWindowsFeatureSet_Uninstall.ps1 +++ /dev/null @@ -1,20 +0,0 @@ -<# - .SYNOPSIS - Uninstalls the TelnetClient and RSAT-File-Services Windows features, including all their - subfeatures. Logs the operation to the file at 'C:\LogPath\Log.log'. -#> -Configuration Sample_xWindowsFeatureSet_Uninstall -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xWindowsFeatureSet WindowsFeatureSet1 - { - Name = @( 'Telnet-Client', 'RSAT-File-Services' ) - Ensure = 'Absent' - IncludeAllSubFeature = $true - LogPath = 'C:\LogPath\Log.log' - } - } -} diff --git a/Examples/Sample_xWindowsOptionalFeature.ps1 b/Examples/Sample_xWindowsOptionalFeature.ps1 deleted file mode 100644 index 25876226e..000000000 --- a/Examples/Sample_xWindowsOptionalFeature.ps1 +++ /dev/null @@ -1,39 +0,0 @@ -<# - .SYNOPSIS - Enables the Windows optional feature with the specified name and outputs a log to the specified path. - - .PARAMETER FeatureName - The name of the Windows optional feature to enable. - - .PARAMETER LogPath - The path to the file to log the enable operation to. - - .NOTES - Can only be run on Windows client operating systems and Windows Server 2012 or later. - The DISM PowerShell module must be available on the target machine. -#> -Configuration Sample_xWindowsOptionalFeature -{ - param - ( - [Parameter (Mandatory = $true)] - [String] - $FeatureName, - - [Parameter(Mandatory = $true)] - [String] - $LogPath - ) - - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xWindowsOptionalFeature TelnetClient - { - Name = $FeatureName - Ensure = 'Present' - LogPath = $LogPath - } - } -} diff --git a/Examples/Sample_xWindowsOptionalFeatureSet_Disable.ps1 b/Examples/Sample_xWindowsOptionalFeatureSet_Disable.ps1 deleted file mode 100644 index dd5813e4a..000000000 --- a/Examples/Sample_xWindowsOptionalFeatureSet_Disable.ps1 +++ /dev/null @@ -1,16 +0,0 @@ -<# - .SYNOPSIS - Disables the Windows optional features TelnetClient and LegacyComponents and removes all - files associated with these features. -#> -Configuration Sample_xWindowsOptionalFeatureSet_Disable -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - xWindowsOptionalFeatureSet WindowsOptionalFeatureSet1 - { - Name = @('TelnetClient', 'LegacyComponents') - Ensure = 'Absent' - RemoveFilesOnDisable = $true - } -} diff --git a/Examples/Sample_xWindowsOptionalFeatureSet_Enable.ps1 b/Examples/Sample_xWindowsOptionalFeatureSet_Enable.ps1 deleted file mode 100644 index 4096d9ad8..000000000 --- a/Examples/Sample_xWindowsOptionalFeatureSet_Enable.ps1 +++ /dev/null @@ -1,20 +0,0 @@ -<# - .SYNOPSIS - Enables the Windows optional features MicrosoftWindowsPowerShellV2 and - Internet-Explorer-Optional-amd64 and outputs a log of the operations to a file at the path - 'C:\LogPath\Log.txt'. -#> -Configuration Sample_xWindowsOptionalFeatureSet_Enable -{ - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xWindowsOptionalFeatureSet WindowsOptionalFeatureSet1 - { - Name = @('MicrosoftWindowsPowerShellV2', 'Internet-Explorer-Optional-amd64') - Ensure = 'Present' - LogPath = 'C:\LogPath\Log.txt' - } - } -} diff --git a/Examples/Sample_xWindowsPackageCab.ps1 b/Examples/Sample_xWindowsPackageCab.ps1 deleted file mode 100644 index c84d2af34..000000000 --- a/Examples/Sample_xWindowsPackageCab.ps1 +++ /dev/null @@ -1,50 +0,0 @@ -<# - .SYNOPSIS - Installs a package from the cab file with the specified name from the specified source path - and outputs a log to the specified log path. - - .PARAMETER Name - The name of the package to install. - - .PARAMETER SourcePath - The path to the cab file to install the package from. - - .PARAMETER LogPath - The path to a file to log the install operation to. - - .NOTES - The DISM PowerShell module must be available on the target machine. -#> -Configuration Sample_xWindowsPackageCab -{ - param - ( - [Parameter (Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [Parameter (Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $SourcePath, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $LogPath - ) - - Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xWindowsPackageCab WindowsPackageCab1 - { - Name = $Name - Ensure = 'Present' - SourcePath = $SourcePath - LogPath = $LogPath - } - } -} diff --git a/Examples/Sample_xWindowsProcess_Start.ps1 b/Examples/Sample_xWindowsProcess_Start.ps1 deleted file mode 100644 index 11ea577f5..000000000 --- a/Examples/Sample_xWindowsProcess_Start.ps1 +++ /dev/null @@ -1,19 +0,0 @@ -<# - .SYNOPSIS - Starts the gpresult process which generates a log about the group policy. - The path to the log is provided in 'Arguments'. -#> -Configuration Sample_xWindowsProcess_Start -{ - Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xWindowsProcess GPresult - { - Path = 'C:\Windows\System32\gpresult.exe' - Arguments = '/h C:\gp2.htm' - Ensure = 'Present' - } - } -} diff --git a/Examples/Sample_xWindowsProcess_StartUnderUser.ps1 b/Examples/Sample_xWindowsProcess_StartUnderUser.ps1 deleted file mode 100644 index ad334293f..000000000 --- a/Examples/Sample_xWindowsProcess_StartUnderUser.ps1 +++ /dev/null @@ -1,37 +0,0 @@ -<# - .SYNOPSIS - Starts the gpresult process under the given credential which generates a log - about the group policy. The path to the log is provided in 'Arguments'. - - .PARAMETER Credential - Credential to start the process under. -#> -Configuration Sample_xWindowsProcess_StartUnderUser -{ - [CmdletBinding()] - param - ( - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential = (Get-Credential) - ) - - Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xWindowsProcess GPresult - { - Path = 'C:\Windows\System32\gpresult.exe' - Arguments = '/h C:\gp2.htm' - Credential = $Credential - Ensure = 'Present' - } - } -} - -<# - To use the sample(s) with credentials, see blog at: - http://blogs.msdn.com/b/powershell/archive/2014/01/31/want-to-secure-credentials-in-windows-powershell-desired-state-configuration.aspx -#> - diff --git a/Examples/Sample_xWindowsProcess_Stop.ps1 b/Examples/Sample_xWindowsProcess_Stop.ps1 deleted file mode 100644 index 304b230a8..000000000 --- a/Examples/Sample_xWindowsProcess_Stop.ps1 +++ /dev/null @@ -1,20 +0,0 @@ -<# - .SYNOPSIS - Stops the gpresult process if it is running. - Since the Arguments parameter isn't needed to stop the process, - an empty string is passed in. -#> -Configuration Sample_xWindowsProcess_Stop -{ - Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xWindowsProcess GPresult - { - Path = 'C:\Windows\System32\gpresult.exe' - Arguments = '' - Ensure = 'Absent' - } - } -} diff --git a/Examples/Sample_xWindowsProcess_StopUnderUser.ps1 b/Examples/Sample_xWindowsProcess_StopUnderUser.ps1 deleted file mode 100644 index 97b817786..000000000 --- a/Examples/Sample_xWindowsProcess_StopUnderUser.ps1 +++ /dev/null @@ -1,40 +0,0 @@ -<# - .SYNOPSIS - Stops the gpresult process running under the given credential if it is running. - Since the Arguments parameter isn't needed to stop the process, - an empty string is passed in. - - .PARAMETER Credential - Credential that the process is running under. -#> -Configuration Sample_xWindowsProcess_StopUnderUser -{ - [CmdletBinding()] - param - ( - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential = (Get-Credential) - ) - - Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' - - Node localhost - { - xWindowsProcess GPresult - { - Path = 'C:\Windows\System32\gpresult.exe' - Arguments = '' - Credential = $Credential - Ensure = 'Absent' - } - } -} - -<# - To use the sample(s) with credentials, see blog at: - http://blogs.msdn.com/b/powershell/archive/2014/01/31/want-to-secure-credentials-in-windows-powershell-desired-state-configuration.aspx -#> - - diff --git a/Examples/xArchive_ExpandArchiveChecksumAndForceConfig.ps1 b/Examples/xArchive_ExpandArchiveChecksumAndForceConfig.ps1 new file mode 100644 index 000000000..5cd3b117d --- /dev/null +++ b/Examples/xArchive_ExpandArchiveChecksumAndForceConfig.ps1 @@ -0,0 +1,56 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 2e89ea6a-3911-4305-837e-73f2bf331b87 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that expands a archive using SHA-256 file validation and + allows overwriting the folders and files in the destination folder. + + .DESCRIPTION + Configuration that expands the archive located at + 'C:\ExampleArchivePath\Archive.zip' to the destination path + 'C:\ExampleDestinationPath\Destination'. + + Since Validate is specified as $true and the Checksum parameter is + specified as SHA-256, the resource will check if the SHA-256 hash of the + file in the archive matches the SHA-256 hash of the corresponding file + at the destination and replace any files that do not match. + + Since Force is specified as $true, the resource will overwrite any + mismatching files at the destination. If Force is specified as $false, + the resource will throw an error instead of overwrite any files at the + destination. +#> +Configuration xArchive_ExpandArchiveChecksumAndForceConfig +{ + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xArchive Archive4 + { + Path = 'C:\ExampleArchivePath\Archive.zip' + Destination = 'C:\ExampleDestinationPath\Destination' + Validate = $true + Checksum = 'SHA-256' + Force = $true + Ensure = 'Present' + } + } +} diff --git a/Examples/xArchive_ExpandArchiveDefaultValidationAndForceConfig.ps1 b/Examples/xArchive_ExpandArchiveDefaultValidationAndForceConfig.ps1 new file mode 100644 index 000000000..b6ff2ec4e --- /dev/null +++ b/Examples/xArchive_ExpandArchiveDefaultValidationAndForceConfig.ps1 @@ -0,0 +1,54 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID f064901d-086a-410c-8b2a-d0e471b8eddb +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that expands a archive using default file validation and + allows overwriting the folders and files in the destination folder. + + .DESCRIPTION + Expands the archive located at 'C:\ExampleArchivePath\Archive.zip' to + the destination path 'C:\ExampleDestinationPath\Destination'. + + Since Validate is specified as $true and the Checksum parameter is not + provided, the resource will check if the last write time of the archive + file matches the last write time of the corresponding file at the + destination and replace any files that do not match. + + Since Force is specified as $true, the resource will overwrite any + mismatching files at the destination. If Force is specified as $false, + the resource will throw an error instead of overwrite any files at the + destination. +#> +Configuration xArchive_ExpandArchiveDefaultValidationAndForceConfig +{ + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xArchive Archive3 + { + Path = 'C:\ExampleArchivePath\Archive.zip' + Destination = 'C:\ExampleDestinationPath\Destination' + Validate = $true + Force = $true + Ensure = 'Present' + } + } +} diff --git a/Examples/xArchive_ExpandArchiveNoValidationConfig.ps1 b/Examples/xArchive_ExpandArchiveNoValidationConfig.ps1 new file mode 100644 index 000000000..557e6f096 --- /dev/null +++ b/Examples/xArchive_ExpandArchiveNoValidationConfig.ps1 @@ -0,0 +1,45 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 635a3105-b4bc-482c-a5f2-ebe7127fd671 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that expands a archive without file validation. + + .DESCRIPTION + Expands the archive located at 'C:\ExampleArchivePath\Archive.zip' to + the destination path 'C:\ExampleDestinationPath\Destination'. + + The resource will only check if the expanded archive files exist at the + destination. No validation is performed on any existing files at the + destination to ensure that they match the files in the archive. +#> +Configuration xArchive_ExpandArchiveNoValidationConfig +{ + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xArchive Archive1 + { + Path = 'C:\ExampleArchivePath\Archive.zip' + Destination = 'C:\ExampleDestinationPath\Destination' + Ensure = 'Present' + } + } +} diff --git a/Examples/xArchive_ExpandArchiveNoValidationCredentialConfig.ps1 b/Examples/xArchive_ExpandArchiveNoValidationCredentialConfig.ps1 new file mode 100644 index 000000000..6c30ea699 --- /dev/null +++ b/Examples/xArchive_ExpandArchiveNoValidationCredentialConfig.ps1 @@ -0,0 +1,59 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 36eb8f8c-e34c-4ec5-be10-8936b415a9a1 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that expands a archive under a credential without file + validation. + + .DESCRIPTION + Expands the archive located at 'C:\ExampleArchivePath\Archive.zip' to + the destination path 'C:\ExampleDestinationPath\Destination'. + + The added specification of a Credential here allows you to provide the + credential of a user to provide the resource access to the archive and + destination paths. + + The resource will only check if the expanded archive files exist at the + destination. No validation is performed on any existing files at the + destination to ensure that they match the files in the archive. +#> +Configuration xArchive_ExpandArchiveNoValidationCredentialConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [System.Management.Automation.PSCredential] + [System.Management.Automation.Credential()] + $Credential + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xArchive Archive2 + { + Path = 'C:\ExampleArchivePath\Archive.zip' + Destination = 'C:\ExampleDestinationPath\Destination' + Credential = $Credential + Ensure = 'Present' + } + } +} diff --git a/Examples/xArchive_RemoveArchiveChecksumConfig.ps1 b/Examples/xArchive_RemoveArchiveChecksumConfig.ps1 new file mode 100644 index 000000000..e98b8fa8b --- /dev/null +++ b/Examples/xArchive_RemoveArchiveChecksumConfig.ps1 @@ -0,0 +1,49 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 662aee36-85dd-47fc-88e8-73d7b4e5f822 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that removes an archive with SHA-256 file validation. + + .DESCRIPTION + Remove the expansion of the archive located at + 'C:\ExampleArchivePath\Archive.zip' from the destination path + 'C:\ExampleDestinationPath\Destination'. + + Since Validate is specified as $true and the Checksum parameter is + specified as SHA-256, the resource will check if the SHA-256 hash of the + file in the archive matches the SHA-256 hash of the corresponding file + at the destination and will not remove any files that do not match. +#> +Configuration xArchive_RemoveArchiveChecksumConfig +{ + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xArchive Archive6 + { + Path = 'C:\ExampleArchivePath\Archive.zip' + Destination = 'C:\ExampleDestinationPath\Destination' + Validate = $true + Checksum = 'SHA-256' + Ensure = 'Absent' + } + } +} diff --git a/Examples/xArchive_RemoveArchiveNoValidationConfig.ps1 b/Examples/xArchive_RemoveArchiveNoValidationConfig.ps1 new file mode 100644 index 000000000..9e029cd51 --- /dev/null +++ b/Examples/xArchive_RemoveArchiveNoValidationConfig.ps1 @@ -0,0 +1,47 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 550a8fae-2a63-49b9-aec2-e31e6fd82135 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that removes an archive without file validation. + + .DESCRIPTION + Removes the expansion of the archive located at + 'C:\ExampleArchivePath\Archive.zip' from the destination path + 'C:\ExampleDestinationPath\Destination'. + + The resource will only check if the expanded archive files exist at the + destination. + No validation is performed on any existing files at the destination to + ensure that they match the files in the archive before removing them. +#> +Configuration xArchive_RemoveArchiveNoValidationConfig +{ + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xArchive Archive5 + { + Path = 'C:\ExampleArchivePath\Archive.zip' + Destination = 'C:\ExampleDestinationPath\Destination' + Ensure = 'Absent' + } + } +} diff --git a/Examples/xEnvironment_AddMultiplePathsConfig.ps1 b/Examples/xEnvironment_AddMultiplePathsConfig.ps1 new file mode 100644 index 000000000..29d9ee027 --- /dev/null +++ b/Examples/xEnvironment_AddMultiplePathsConfig.ps1 @@ -0,0 +1,100 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID dafafad2-d581-4db2-841c-7095c5c3ed30 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that creates or modifies an environment variable containing + paths. + + .DESCRIPTION + Configuration that creates or modifies an environment variable containing + paths. + If the environment variable does not exist, the environment variable is + created, and the paths will added as values. + If the environment variable already exist, an either of the new path + values do not exist in the environment variable, they will be appended + without modifying any preexisting values. If either of the paths already + exist as a value in in the environment variable, that path will be + skipped (it is not added twice). + + .PARAMETER Name + The name of the environment variable to create or modify. + + .PARAMETER Value + The paths to add to the environment variable as a comma-separated list, + e.g. 'C:\test123;C:\test456;C:\test789'. + + .PARAMETER Target + The scope to set the environment variable. Can be set to either the + 'Machine', the 'Process' or both. Default value is 'Machine'. + { Process | Machine } + + .EXAMPLE + xEnvironment_AddMultiplePathsConfig -Name 'TestPath' -Value 'C:\test123;C:\test456;C:\test789' -Target @('Process', 'Machine') + + Compiles a configuration that creates the environment variable + 'TestPath' with the paths 'C:\test123', 'C:\test456' and 'C:\test789' + in both the scopes 'Machine' and 'Process'. + + .EXAMPLE + $configurationParameters = @{ + Name = 'TestPath' + Value = 'C:\test123;C:\test456;C:\test789' + Target = @('Process', 'Machine') + } + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xEnvironment_AddMultiplePathsConfig' -Parameters $configurationParameters + + Compiles a configuration in Azure Automation that creates the environment + variable 'TestPath' with the paths 'C:\test123', 'C:\test456' + and 'C:\test789' in both the scopes 'Machine' and 'Process'. + + Replace the and with correct values. +#> +Configuration xEnvironment_AddMultiplePathsConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Name, + + [Parameter(Mandatory = $true)] + [System.String] + $Value, + + [Parameter()] + [ValidateSet('Process', 'Machine')] + [System.String[]] + $Target = 'Machine' + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xEnvironment 'AddMultiplePaths' + { + Name = $Name + Value = $Value + Ensure = 'Present' + Path = $true + Target = $Target + } + } +} diff --git a/Examples/xEnvironment_CreateNonPathVariableConfig.ps1 b/Examples/xEnvironment_CreateNonPathVariableConfig.ps1 new file mode 100644 index 000000000..f4668c8b2 --- /dev/null +++ b/Examples/xEnvironment_CreateNonPathVariableConfig.ps1 @@ -0,0 +1,94 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID ee586cfa-237c-4e5f-929e-9b420afabc91 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that creates or modifies an environment variable. + + .DESCRIPTION + Configuration that creates or modifies an environment variable. + If the environment variable does not exist, the environment variable is + created, and the value will be added. + If the environment variable already exist, and the value differs, then + the value will be changed. + + .PARAMETER Name + The name of the environment variable to create or modify. + + .PARAMETER Value + The value to set on the environment variable. + + .PARAMETER Target + The scope to set the environment variable. Can be set to either the + 'Machine', the 'Process' or both. Default value is 'Machine'. + { Process | Machine } + + .EXAMPLE + xEnvironment_CreateNonPathVariableConfig -Name 'TestVariable' -Value 'TestValue' -Target @('Process', 'Machine') + + Compiles a configuration that creates the environment variable + 'TestVariable' and sets the value to 'TestValue' both on the machine + scope and within the process scope. + + .EXAMPLE + $configurationParameters = @{ + Name = 'TestVariable' + Value = 'TestValue' + Target = @('Process', 'Machine') + } + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xEnvironment_CreateNonPathVariableConfig' -Parameters $configurationParameters + + Compiles a configuration in Azure Automation that creates the environment + variable 'TestVariable' and sets the value to 'TestValue' both on the + machine scope and within the process scope. + + Replace the and with correct values. +#> +Configuration xEnvironment_CreateNonPathVariableConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Name, + + [Parameter(Mandatory = $true)] + [System.String] + $Value, + + [Parameter()] + [ValidateSet('Process', 'Machine')] + [System.String[]] + $Target = 'Machine' + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xEnvironment 'NewVariable' + { + Name = $Name + Value = $Value + Ensure = 'Present' + Path = $false + Target = $Target + } + } +} diff --git a/Examples/xEnvironment_RemoveMultiplePathsConfig.ps1 b/Examples/xEnvironment_RemoveMultiplePathsConfig.ps1 new file mode 100644 index 000000000..7767168ca --- /dev/null +++ b/Examples/xEnvironment_RemoveMultiplePathsConfig.ps1 @@ -0,0 +1,97 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID c24aa186-1765-4d8a-9204-14624e7b7f8a +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that modifies an environment variable containing paths. + + .DESCRIPTION + Configuration that removes one or more path values, if the values exist, + from and environment variable containing paths. Other values of the + environment variable will not be modified and will be left intact. + + .PARAMETER Name + The name of the environment variable to modify. + + .PARAMETER Value + The paths to remove from the environment variable as a comma-separated + list, e.g. 'C:\test123;C:\test456'. + + .PARAMETER Target + The scope in which to modify the environment variable. Can be set to + either the 'Machine', the 'Process' or both. Default value is 'Machine'. + { Process | Machine } + + .EXAMPLE + xEnvironment_RemoveMultiplePathsConfig -Name 'TestPath' -Value 'C:\test456;C:\test123' -Target @('Process', 'Machine') + + Compiles a configuration that removes the paths 'C:\test123' and + 'C:\test456', if the values exist, from the environment variable 'TestPath' + in both the scopes 'Machine' and 'Process'. + Other values of the environment variable 'TestPath' will not be modified, + and will be left intact. + + .EXAMPLE + $configurationParameters = @{ + Name = 'TestPath' + Value = 'C:\test456;C:\test123' + Target = @('Process', 'Machine') + } + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xEnvironment_RemoveMultiplePathsConfig' -Parameters $configurationParameters + + Compiles a configuration in Azure Automation that removes the paths + 'C:\test123' and 'C:\test456', if the values exist, from the environment + variable 'TestPath' in both the scopes 'Machine' and 'Process'. + Other values of the environment variable 'TestPath' will not be modified, + and will be left intact. + + Replace the and with correct values. +#> +Configuration xEnvironment_RemoveMultiplePathsConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Name, + + [Parameter(Mandatory = $true)] + [System.String] + $Value, + + [Parameter()] + [ValidateSet('Process', 'Machine')] + [System.String[]] + $Target = 'Machine' + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xEnvironment 'RemoveMultiplePaths' + { + Name = $Name + Value = $Value + Ensure = 'Absent' + Path = $true + Target = $Target + } + } +} diff --git a/Examples/xEnvironment_RemoveVariableConfig.ps1 b/Examples/xEnvironment_RemoveVariableConfig.ps1 new file mode 100644 index 000000000..c878f1917 --- /dev/null +++ b/Examples/xEnvironment_RemoveVariableConfig.ps1 @@ -0,0 +1,79 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 845b267f-e47e-4305-88b6-d1086e6c1405 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that removes an environment variable. + + .DESCRIPTION + Configuration that removes an environment variable. + + .PARAMETER Name + The name of the environment variable to remove. + + .PARAMETER Target + The scope in which to remove the environment variable. Can be set to + either the 'Machine', the 'Process' or both. Default value is 'Machine'. + { Process | Machine } + + .EXAMPLE + xEnvironment_RemoveVariableConfig -Name 'TestVariable' -Target @('Process', 'Machine') + + Compiles a configuration that removes the environment variable + 'TestVariable' from both the machine and the process scope. + + .EXAMPLE + $configurationParameters = @{ + Name = 'TestVariable' + Target = @('Process', 'Machine') + } + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xEnvironment_RemoveVariableConfig' -Parameters $configurationParameters + + Compiles a configuration in Azure Automation that removes the environment + variable 'TestVariable' from both the machine and the process scope. + + Replace the and with correct values. +#> +Configuration xEnvironment_RemoveVariableConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Name, + + [Parameter()] + [ValidateSet('Process', 'Machine')] + [System.String[]] + $Target = 'Machine' + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xEnvironment 'NewVariable' + { + Name = $Name + Ensure = 'Absent' + Path = $false + Target = $Target + } + } +} diff --git a/Examples/xFileUpload_UploadToSMBShareConfig.ps1 b/Examples/xFileUpload_UploadToSMBShareConfig.ps1 new file mode 100644 index 000000000..477c765fb --- /dev/null +++ b/Examples/xFileUpload_UploadToSMBShareConfig.ps1 @@ -0,0 +1,88 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 4b9e3719-034a-4f3e-aa48-321cc242fa9e +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that uploads file or folder to a SMB share. + + .DESCRIPTION + Configuration that uploads file or folder to a SMB share. + + .PARAMETER DestinationPath + The destination SMB share to upload to. It must be the root of the SMB + share or an existing folder under the SMB share, + e.g. '\\MachineName\ShareName\DestinationFolder'. + + .PARAMETER SourcePath + The source file or folder to upload, e.g. 'C:\Folder' or + 'C:\Folder\file.txt'. + + .PARAMETER Credential + Credentials to access the SMB share where file or folder should be + uploaded. + + .PARAMETER CertificateThumbprint + Thumbprint of the certificate which should be used for encryption and + decryption of the password. The certificate must already exist on the + target node in the machine personal store ('cert:\LocalMachine\My'). + This parameter must be provided if the Credential parameter is provided. + + .EXAMPLE + xFileUpload_UploadToSMBShareConfig -DestinationPath '\\MachineName\Folder' -SourcePath 'C:\Folder\file.txt' -Credential (Get-Credential) -CertificateThumbprint 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' + + Compiles a configuration that uploads the file 'C:\Folder\file.txt' to + the root od the SMB share '\\MachineName\Folder', and uses the thumbprint + 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' to encrypt and decrypt the + password of the credentials, the credential is used to log in to the + SMB share. +#> +Configuration xFileUpload_UploadToSMBShareConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $DestinationPath, + + [Parameter(Mandatory = $true)] + [System.String] + $SourcePath, + + [Parameter()] + [PSCredential] + $Credential, + + [Parameter()] + [System.String] + $CertificateThumbprint + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xFileUpload fileUpload + { + DestinationPath = $DestinationPath + SourcePath = $SourcePath + Credential = $Credential + CertificateThumbprint = $CertificateThumbprint + } + } +} diff --git a/Examples/xGroupSet_AddMembersConfig.ps1 b/Examples/xGroupSet_AddMembersConfig.ps1 new file mode 100644 index 000000000..0572d915d --- /dev/null +++ b/Examples/xGroupSet_AddMembersConfig.ps1 @@ -0,0 +1,83 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID db98d037-c170-43cc-a716-da521731e84f +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that add members to multiple groups. + + .DESCRIPTION + Configuration that add members to multiple groups and make sure the users + are added back as members of the groups if they are ever removed. + + If a group does not exist, the group is created and the members are added. + + .PARAMETER Name + The name of one or more groups to add members to. + + .PARAMETER MembersToInclude + One or more usernames of the users that should be added as members of the + group. + + .EXAMPLE + xGroupSet_AddMembersConfig -Name @('Administrators', 'GroupName1') -Members @('Username1', 'Username2') + + Compiles a configuration that adds the users that have the usernames + 'Username1' and 'Username2' to each of the groups 'GroupName1' and + 'Administrators'. + If the groups named 'GroupName1' or 'Administrators' do not exist, creates + the groups named 'GroupName1' and 'Administrators' and adds the users + with the usernames 'Username1' and 'Username2' to both groups. + + .EXAMPLE + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xGroupSet_AddMembersConfig' -Parameters @{ Name = @('Administrators', 'GroupName1'); Members = @('Username1', 'Username2') } + + Compiles a configuration in Azure Automation that adds the users that + have the usernames 'Username1' and 'Username2' to each of the groups + 'GroupName1' and 'Administrators'. + If the groups named 'GroupName1' or 'Administrators' do not exist, creates + the groups named 'GroupName1' and 'Administrators' and adds the users + with the usernames 'Username1' and 'Username2' to both groups. + + Replace the and with correct values. +#> +Configuration xGroupSet_AddMembersConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [System.String[]] + $Name, + + [Parameter()] + [System.String[]] + $MembersToInclude + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xGroupSet 'AddMembers' + { + GroupName = $Name + Ensure = 'Present' + MembersToInclude = $MembersToInclude + } + } +} diff --git a/Examples/xGroup_RemoveMembersConfig.ps1 b/Examples/xGroup_RemoveMembersConfig.ps1 new file mode 100644 index 000000000..e5fcfdb18 --- /dev/null +++ b/Examples/xGroup_RemoveMembersConfig.ps1 @@ -0,0 +1,89 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 84717cb3-a5d9-41dd-82c3-32b3068502f2 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that make sure a group exist and the specified users are + not member of the group. + + .DESCRIPTION + Configuration that make sure a group exist and have the correct members. + + If the group does not exist, adds the users and make sure the members of + the group are only those that are in the configuration. If the group + already exists and if there are any members not in the configuration, + those members will be removed from the group, and any missing members + that are in the configuration will be added to the group. + + .PARAMETER Name + The name of the group to create or/and remove members from. + + .PARAMETER MembersToExclude + One or more usernames of the users that should be removed as member of + the group. + + .EXAMPLE + xGroup_RemoveMembersConfig -Name 'GroupName1' -MembersToExclude @('Username1', 'Username2') + + Compiles a configuration that creates the group 'GroupName1, if it does + not already exist, and will the make sure the users with the usernames + 'Username1' or 'Username2' are removed as member from the group if the + users are ever added as members. + If the group named GroupName1 already exists, will make sure the users + with the usernames 'Username1' or 'Username2' are removed as member from + the group if the users are ever added as members. + + .EXAMPLE + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xGroup_RemoveMembersConfig' -Parameters @{ Name = 'GroupName1'; MembersToExclude = @('Username1', 'Username2') } + + Compiles a configuration in Azure Automation that creates the group + 'GroupName1, if it does not already exist, and will the make sure the + users with the usernames 'Username1' or 'Username2' are removed as member + from the group if the users are ever added as members. + If the group named GroupName1 already exists, will make sure the users + with the usernames 'Username1' or 'Username2' are removed as member from + the group if the users are ever added as members. + + Replace the and with correct values. +#> +Configuration xGroup_RemoveMembersConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Name, + + [Parameter()] + [System.String[]] + $MembersToExclude + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xGroup 'RemoveMembers' + { + GroupName = $Name + Ensure = 'Present' + MembersToExclude = $MembersToExclude + } + } +} diff --git a/Examples/xGroup_SetMembersConfig.ps1 b/Examples/xGroup_SetMembersConfig.ps1 new file mode 100644 index 000000000..3e161812e --- /dev/null +++ b/Examples/xGroup_SetMembersConfig.ps1 @@ -0,0 +1,86 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 8662bf80-5818-463b-8954-daf8a79525e7 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that make sure a group exist and have the correct members. + + .DESCRIPTION + Configuration that make sure a group exist and have the correct members. + + If the group does not exist, adds the users and make sure the members of + the group are only those that are in the configuration. If the group + already exists and if there are any members not in the configuration, + those members will be removed from the group, and any missing members + that are in the configuration will be added to the group. + + .PARAMETER Name + The name of the group to create or/and add members to. + + .PARAMETER Members + One or more usernames of the users that should be the only members of the + group. + + .EXAMPLE + xGroup_SetMembersConfig -Name 'GroupName1' -Members @('Username1', 'Username2') + + Compiles a configuration that creates the group 'GroupName1, if it does + not already exist, and adds the users with the usernames 'Username1' + and 'Username2' to the group. If the group named GroupName1 already + exists, removes any users that do not have the usernames Username1 or + Username2 from the group and adds the users that have the usernames + Username1 and Username2 to the group. + + .EXAMPLE + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xGroup_SetMembersConfig' -Parameters @{ Name = 'GroupName1'; Members = @('Username1', 'Username2') } + + Compiles a configuration in Azure Automation that creates the group + 'GroupName1, if it does not already exist, and adds the users with the + usernames 'Username1' and 'Username2' to the group. + If the group named GroupName1 already exists, removes any users that do + not have the usernames Username1 or Username2 from the group and adds + the users that have the usernames Username1 and Username2 to the group. + + Replace the and with correct values. +#> +Configuration xGroup_SetMembersConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Name, + + [Parameter()] + [System.String[]] + $Members + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xGroup 'SetMembers' + { + GroupName = $Name + Ensure = 'Present' + Members = $Members + } + } +} diff --git a/Examples/xMsiPackage_InstallPackageConfig.ps1 b/Examples/xMsiPackage_InstallPackageConfig.ps1 new file mode 100644 index 000000000..f1eeba7a0 --- /dev/null +++ b/Examples/xMsiPackage_InstallPackageConfig.ps1 @@ -0,0 +1,88 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 58632bf6-5a7f-4a85-bca6-59795c8aa801 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that install an MSI file. + + .DESCRIPTION + Configuration that install an MSI file with the specified product + identification number. + + .PARAMETER ProductId + The product identification number in the format + '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}'. + + .PARAMETER Path + The URI path. Should start with an URI scheme, e.g. 'file://','http://', + 'https://'. + + .NOTES + When using the file scheme, the MSI file with the given product + identification number must already exist at the specified path. + When using the http or https scheme, the MSI file with the given product + identification number must already exist on the server. + + The product ID and path value in this file are provided for example + purposes only and will need to be replaced with valid values. + + You can run the following command to get a list of all available MSI's on + your system with the correct Path (LocalPackage) and product ID (IdentifyingNumber): + + Get-WmiObject Win32_Product | Format-Table IdentifyingNumber, Name, LocalPackage + + .EXAMPLE + xMsiPackage_InstallPackageConfig -ProductId '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' -Path 'file://Examples/example.msi' + + Compiles a configuration that installs the MSI package located at + the path 'file://Examples/example.msi' having the product identification + number as '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}'. + + .EXAMPLE + xMsiPackage_InstallPackageConfig -ProductId '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' -Path 'http://Examples/example.msi' + + Compiles a configuration that installs the MSI package located at + the URL 'http://Examples/example.msi' having the product identification + number as '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}'. +#> +Configuration xMsiPackage_InstallPackageConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $ProductId, + + [Parameter(Mandatory = $true)] + [System.String] + $Path + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xMsiPackage MsiPackage1 + { + ProductId = $ProductId + Path = $Path + Ensure = 'Present' + } + } +} diff --git a/Examples/xMsiPackage_UninstallPackageFromFileConfig.ps1 b/Examples/xMsiPackage_UninstallPackageFromFileConfig.ps1 new file mode 100644 index 000000000..3f1a94aa7 --- /dev/null +++ b/Examples/xMsiPackage_UninstallPackageFromFileConfig.ps1 @@ -0,0 +1,55 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 33aa3450-fa8a-4eb7-9291-c0d374e7778e +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Uninstalls the MSI file with the product ID using a file located at a + file path. + + .DESCRIPTION + Uninstalls the MSI file with the product ID: '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' + at the path: 'file://Examples/example.msi'. + + .NOTES + The MSI file with the given product ID must already exist at the specified + path. + + The product ID and path value in this file are provided for example + purposes only and will need to be replaced with valid values. + + You can run the following command to get a list of all available MSI's + on your system with the correct Path (LocalPackage) and product ID + (IdentifyingNumber): + + Get-WmiObject Win32_Product | Format-Table IdentifyingNumber, Name, LocalPackage +#> +Configuration xMsiPackage_UninstallPackageFromFileConfig +{ + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xMsiPackage 'UninstallMsiPackageFromFile' + { + ProductId = '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' + Path = 'file://Examples/example.msi' + Ensure = 'Absent' + } + } +} diff --git a/Examples/xMsiPackage_UninstallPackageFromHttpsConfig.ps1 b/Examples/xMsiPackage_UninstallPackageFromHttpsConfig.ps1 new file mode 100644 index 000000000..ae4119cd2 --- /dev/null +++ b/Examples/xMsiPackage_UninstallPackageFromHttpsConfig.ps1 @@ -0,0 +1,56 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 6492da05-37f4-47c3-9c72-19da8983dfa0 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Uninstalls the MSI file with the product ID using a file that is + accessed through an URL. + + .DESCRIPTION + Uninstalls the MSI file with the product ID: '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' + at the path: 'https://Examples/example.msi'. + + .NOTES + The MSI file with the given product ID must already exist on + the server. + + The product ID and path value in this file are provided for + example purposes only and will need to be replaced with valid values. + + You can run the following command to get a list of all available MSI's + on your system with the correct Path (LocalPackage) and product ID + (IdentifyingNumber): + + Get-WmiObject Win32_Product | Format-Table IdentifyingNumber, Name, LocalPackage + +#> +Configuration xMsiPackage_UninstallPackageFromHttpsConfig +{ + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xMsiPackage 'UninstallMsiPackageFromHttps' + { + ProductId = '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' + Path = 'https://Examples/example.msi' + Ensure = 'Absent' + } + } +} diff --git a/Examples/xPSEndpoint_NewConfig.ps1 b/Examples/xPSEndpoint_NewConfig.ps1 new file mode 100644 index 000000000..a0c7e7388 --- /dev/null +++ b/Examples/xPSEndpoint_NewConfig.ps1 @@ -0,0 +1,84 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID f7ec2dc4-ee13-4aba-b475-879661bff837 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that creates and registers a new session configuration + endpoint. + + .DESCRIPTION + Configuration that creates and registers a new session configuration + endpoint. + + .PARAMETER Name + The name of the session configuration. + + .PARAMETER AccessMode + The access mode for the session configuration. The default value is 'Remote'. + + .EXAMPLE + xPSEndpoint_NewConfig -Name 'MaintenanceShell' + + Compiles a configuration that creates and registers a new session configuration + endpoint named 'MaintenanceShell'. + + .EXAMPLE + xPSEndpoint_NewConfig -Name 'MaintenanceShell' + + Compiles a configuration that creates and registers a new session + configuration endpoint named 'MaintenanceShell'. + + .EXAMPLE + xPSEndpoint_NewConfig -Name 'Microsoft.PowerShell.Workflow' -AccessMode 'Local' + + Compiles a configuration that sets the access mode to 'Local' for the + endpoint named 'Microsoft.PowerShell.Workflow'. + + .EXAMPLE + xPSEndpoint_NewConfig -Name 'Microsoft.PowerShell.Workflow' -AccessMode 'Disable' + + Compiles a configuration that disables access for the endpoint named + 'Microsoft.PowerShell.Workflow'. +#> +configuration xPSEndpoint_NewConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Name, + + [Parameter()] + [ValidateSet('Local', 'Remote', 'Disabled')] + [System.String] + $AccessMode = 'Remote' + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node 'localhost' + { + xPSEndpoint 'NewEndpoint' + { + Name = $Name + AccessMode = $AccessMode + Ensure = 'Present' + } + } +} diff --git a/Examples/xPSEndpoint_NewCustomConfig.ps1 b/Examples/xPSEndpoint_NewCustomConfig.ps1 new file mode 100644 index 000000000..5865e5b7b --- /dev/null +++ b/Examples/xPSEndpoint_NewCustomConfig.ps1 @@ -0,0 +1,100 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID b6c3a531-1727-4c11-b0d0-162073e09933 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that creates and registers a new session configuration + endpoint. + + .DESCRIPTION + Configuration that creates and registers a new session configuration + endpoint. + + .PARAMETER Name + The name of the session configuration. + + .PARAMETER AccessMode + The access mode for the session configuration. The default value is 'Remote'. + + .PARAMETER RunAsCredential + The credential for commands of this session configuration. + + .PARAMETER SecurityDescriptorSddl + The permissions that are required to use the new session configuration + in the form of a Security Descriptor Definition Language (SDDL) string. + + .PARAMETER StartupScript + The access mode for the session configuration. The default value is + 'Remote'. + + .NOTES + To use the sample(s) with credentials, see blog at + http://blogs.msdn.com/b/powershell/archive/2014/01/31/want-to-secure-credentials-in-windows-powershell-desired-state-configuration.aspx + + .EXAMPLE + xPSEndpoint_NewCustomConfig -Name 'MaintenanceShell' -RunAsCredential (Get-Credential) -AccessMode 'Remote' -SecurityDescriptorSddl 'O:NSG:BAD:P(A;;GX;;;DU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)' -StartupScript 'C:\Scripts\Maintenance.ps1' + + Compiles a configuration that creates and registers a new session configuration + endpoint named 'MaintenanceShell'. The group 'Domain Users' has Invoke + permission, and commands will run with the credentials provided in the + parameter RunAsCredential. The script 'C:\Scripts\Maintenance.ps1' will + run when a new session is started using this session configuration + endpoint. +#> +configuration xPSEndpoint_NewCustomConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Name, + + [Parameter()] + [ValidateSet('Local', 'Remote', 'Disabled')] + [System.String] + $AccessMode = 'Remote', + + [Parameter(Mandatory = $true)] + [PSCredential] + $RunAsCredential, + + [Parameter(Mandatory = $true)] + [System.String] + $SecurityDescriptorSddl, + + [Parameter(Mandatory = $true)] + [System.String] + $StartupScript + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node 'localhost' + { + xPSEndpoint 'NewEndpoint' + { + Name = $Name + Ensure = 'Present' + AccessMode = $AccessMode + RunAsCredential = $RunAsCredential + SecurityDescriptorSddl = $SecurityDescriptorSddl + StartupScript = $StartupScript + } + } +} diff --git a/Examples/xPSEndpoint_NewWithDefaultsConfig.ps1 b/Examples/xPSEndpoint_NewWithDefaultsConfig.ps1 new file mode 100644 index 000000000..e7f078886 --- /dev/null +++ b/Examples/xPSEndpoint_NewWithDefaultsConfig.ps1 @@ -0,0 +1,57 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID be206016-df05-4f2d-8e5a-9bf9416ac33d +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that creates and registers a new session configuration + endpoint. + + .DESCRIPTION + Configuration that creates and registers a new session configuration + endpoint. + + .PARAMETER Name + The name of the session configuration. + + .EXAMPLE + xPSEndpoint_NewWithDefaultsConfig -Name 'MaintenanceShell' + + Compiles a configuration that creates and registers a new session + configuration endpoint named 'MaintenanceShell'. +#> +configuration xPSEndpoint_NewWithDefaultsConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Name + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node 'localhost' + { + xPSEndpoint 'NewEndpoint' + { + Name = $Name + Ensure = 'Present' + } + } +} diff --git a/Examples/xPSEndpoint_RemoveConfig.ps1 b/Examples/xPSEndpoint_RemoveConfig.ps1 new file mode 100644 index 000000000..cd11a9150 --- /dev/null +++ b/Examples/xPSEndpoint_RemoveConfig.ps1 @@ -0,0 +1,56 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 6a28a133-9d81-451b-a07f-eb9c61b4d283 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that removes an existing session configuration endpoint. + + .DESCRIPTION + Configuration that creates and registers a new session configuration + endpoint. + + .PARAMETER Name + The name of the session configuration. + + .EXAMPLE + xPSEndpoint_RemoveConfig -Name 'MaintenanceShell' + + Compiles a configuration that removes the session configuration + endpoint named 'MaintenanceShell'. +#> +configuration xPSEndpoint_RemoveConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Name + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node 'localhost' + { + xPSEndpoint 'RemoveEndpoint' + { + Name = $Name + Ensure = 'Absent' + } + } +} diff --git a/Examples/xPackage_InstallExeUsingCredentialsAndRegistryConfig.ps1 b/Examples/xPackage_InstallExeUsingCredentialsAndRegistryConfig.ps1 new file mode 100644 index 000000000..94cb14445 --- /dev/null +++ b/Examples/xPackage_InstallExeUsingCredentialsAndRegistryConfig.ps1 @@ -0,0 +1,154 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 98e37dfd-cefb-4de6-8485-2ed8e5ca8959 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that installs an .exe using credentials, and uses another + set of credentials to access the installer. Also uses custom registry + data to discover the package. + + .DESCRIPTION + Configuration that installs an .exe using credentials, and uses another + set of credentials to access the installer. Also uses custom registry + data to discover the package. + + .PARAMETER PackageName + The name of the package to install. + + .PARAMETER Path + The path to the executable to install. + + .PARAMETER Arguments + The command line arguments passed on the installation command line. + When installing MSI packages, the `/quiet` and `/norestart` arguments + are automatically applied. + + .PARAMETER ProductId + The product identification number of the package (usually a GUID). + This parameter accepts an empty System.String. + + .PARAMETER InstalledCheckRegKey + That path in the registry where the value should be created. + + .PARAMETER InstalledCheckRegValueName + The name of the registry value to create. + + .PARAMETER InstalledCheckRegValueData + The data that should be set to the registry value. + + .PARAMETER Credential + The credential to access the executable in the parameter Path. + + .PARAMETER RunAsCredential + The credentials used to install the package on the target node. + + .NOTES + The reg key and value is created by xPackage. + + .EXAMPLE + $configurationParameters = @{ + PackageName = 'Package Name' + Path = '\\software\installer.exe' + InstalledCheckRegKey = 'SOFTWARE\Microsoft\DevDiv\winexpress\Servicing\12.0\coremsi' + InstalledCheckRegValueName = 'Install' + InstalledCheckRegValueData = '1' + CreateCheckRegValue = $true + Credential = (Get-Credential) + RunAsCredential = (Get-Credential) + Arguments = '/q' + ProductId = '' + } + xPackage_InstallExeUsingCredentialsAndRegistryConfig @configurationParameters + + Compiles a configuration that installs a package named 'Package Name' + located in the path '\\software\installer.exe', using the arguments '/q', + The executable is accessed using the credentials in parameter Credentials, + and installed using the credential in RunAsCredential parameter. + Also uses custom registry data to discover the package. +#> +Configuration xPackage_InstallExeUsingCredentialsAndRegistryConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $PackageName, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Path, + + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + [System.String] + $ProductId, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $InstalledCheckRegKey, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $InstalledCheckRegValueName, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $InstalledCheckRegValueData, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [PSCredential] + $Credential, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [PSCredential] + $RunAsCredential, + + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + [System.String] + $Arguments + ) + + Import-DscResource -ModuleName xPSDesiredStateConfiguration + + Node localhost + { + xPackage 'InstallExe' + { + Ensure = 'Present' + Name = $PackageName + Path = $Path + Arguments = $Arguments + RunAsCredential = $RunAsCredential + Credential = $Credential + ProductId = $ProductId + CreateCheckRegValue = $true + InstalledCheckRegKey = $InstalledCheckRegKey + InstalledCheckRegValueName = $InstalledCheckRegValueName + InstalledCheckRegValueData = $InstalledCheckRegValueData + } + } +} diff --git a/Examples/xPackage_InstallExeUsingCredentialsConfig.ps1 b/Examples/xPackage_InstallExeUsingCredentialsConfig.ps1 new file mode 100644 index 000000000..e23a84a86 --- /dev/null +++ b/Examples/xPackage_InstallExeUsingCredentialsConfig.ps1 @@ -0,0 +1,98 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID b89e163c-48d0-4038-aecd-8c759cfee61e +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that installs an .exe using credentials, and uses another + set of credentials to access the installer. + + .DESCRIPTION + Configuration that installs an .exe using credentials, and uses another + set of credentials to access the installer. + + .PARAMETER PackageName + The name of the package to install. + + .PARAMETER Path + The path to the executable to install. + + .PARAMETER ProductId + The product identification number of the package (usually a GUID). + This parameter accepts an empty System.String. + + .PARAMETER Credential + The credential to access the executable in the parameter Path. + + .PARAMETER RunAsCredential + The credentials used to install the package on the target node. + + .EXAMPLE + xPackage_InstallExeUsingCredentialsConfig -PackageName 'Package Name' -Path '\\software\installer.exe' -ProductId '' -Credential (Get-Credential) -RunAsCredential (Get-Credential) + + Compiles a configuration that installs a package named 'Package Name' + located in the path '\\software\installer.exe' that is access using + the credentials in parameter Credentials, and installed using the + credential in RunAsCredential parameter. +#> +Configuration xPackage_InstallExeUsingCredentialsConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $PackageName, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Path, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $ProductId, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [PSCredential] + $Credential, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [PSCredential] + $RunAsCredential + ) + + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xPackage 'InstallExe' + { + Ensure = 'Present' + Name = $PackageName + Path = $Path + RunAsCredential = $RunAsCredential + Credential = $Credential + ProductId = $ProductId + } + } +} diff --git a/Examples/xPackage_InstallMsiConfig.ps1 b/Examples/xPackage_InstallMsiConfig.ps1 new file mode 100644 index 000000000..5b606f665 --- /dev/null +++ b/Examples/xPackage_InstallMsiConfig.ps1 @@ -0,0 +1,66 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 596fd9ca-7c00-4aa3-8efc-8e77c96942bf +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that installs an .msi that matches via the Name. + + .DESCRIPTION + Configuration that installs an .msi that matches via the Name. + + .PARAMETER PackageName + The name of the package to install. + + .PARAMETER Path + The path to the executable to install. + + .EXAMPLE + xPackage_InstallMsiConfig -PackageName 'Package Name' -Path '\\software\installer.msi' + + Compiles a configuration that installs a package named 'Package Name' + located in the path '\\software\installer.msi'. +#> +Configuration xPackage_InstallMsiConfig +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] + $PackageName, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] + $Path + ) + + Import-DscResource -ModuleName xPSDesiredStateConfiguration + + Node localhost + { + xPackage 'InstallMsi' + { + Ensure = 'Present' + Name = $PackageName + Path = $Path + ProductId = '' + } + } +} diff --git a/Examples/xPackage_InstallMsiUsingProductIdConfig.ps1 b/Examples/xPackage_InstallMsiUsingProductIdConfig.ps1 new file mode 100644 index 000000000..6443fe53b --- /dev/null +++ b/Examples/xPackage_InstallMsiUsingProductIdConfig.ps1 @@ -0,0 +1,76 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID fd8e2fd1-7539-4d6c-a203-e88a99e7195d +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that installs an .msi and matches based on the product id. + + .DESCRIPTION + Configuration that installs an .msi and matches based on the product id. + + .PARAMETER PackageName + The name of the package to install. + + .PARAMETER Path + The path to the executable to install. + + .PARAMETER ProductId + The product identification number of the package (usually a GUID). + This parameter accepts an empty System.String. + + .EXAMPLE + xPackage_InstallMsiConfig -PackageName 'Package Name' -Path '\\software\installer.msi' -ProductId '{F06FB2D7-C22C-4987-9545-7C3B15BBBD60}' + + Compiles a configuration that installs a package named 'Package Name' + located in the path '\\software\installer.msi', witht he product + identification number '{F06FB2D7-C22C-4987-9545-7C3B15BBBD60}'. +#> +Configuration xPackage_InstallMsiUsingProductIdConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $PackageName, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Path, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $ProductId + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xPackage 'InstallMsi' + { + Ensure = "Present" + Name = $PackageName + Path = $Path + ProductId = $ProductId + } + } +} diff --git a/Examples/xProcessSet_StartProcessConfig.ps1 b/Examples/xProcessSet_StartProcessConfig.ps1 new file mode 100644 index 000000000..3879b62a2 --- /dev/null +++ b/Examples/xProcessSet_StartProcessConfig.ps1 @@ -0,0 +1,66 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID c95c81b4-0e63-495c-8bc0-4a106931c463 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that starts one or more processes. + + .DESCRIPTION + Configuration that starts one or more processes, without any arguments. + + .PARAMETER Path + One or more paths to the executable to start a process for. + + .EXAMPLE + xProcessSet_StartProcessConfig -Path @('C:\Windows\System32\cmd.exe', 'C:\TestPath\TestProcess.exe') + + Compiles a configuration that starts the processes with the executable + with no arguments at the file paths 'C:\Windows\cmd.exe' and + 'C:\TestPath\TestProcess.exe'. + + .EXAMPLE + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xProcessSet_StartProcessConfig' -Parameters @{ Path = @('C:\Windows\System32\cmd.exe', 'C:\TestPath\TestProcess.exe') } + + Compiles a configuration in Azure Automation that starts the processes + with the executable with no arguments at the file paths 'C:\Windows\cmd.exe' + and 'C:\TestPath\TestProcess.exe'. + + Replace the and with correct values. +#> +Configuration xProcessSet_StartProcessConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String[]] + $Path + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xProcessSet 'StartProcess' + { + Path = $Path + Ensure = 'Present' + } + } +} diff --git a/Examples/xProcessSet_StopProcessConfig.ps1 b/Examples/xProcessSet_StopProcessConfig.ps1 new file mode 100644 index 000000000..408fe7e58 --- /dev/null +++ b/Examples/xProcessSet_StopProcessConfig.ps1 @@ -0,0 +1,67 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 215fd763-50ac-4b04-94cd-b125d6ba86d0 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that stops one or more processes. + + .DESCRIPTION + Configuration that stop one or more processes. Logs any output to the + path 'C:\Output.log'. + + .PARAMETER Path + One or more paths to the executable to stop the process for. + + .EXAMPLE + xProcessSet_StopProcessConfig -Path @('C:\Windows\System32\cmd.exe', 'C:\TestPath\TestProcess.exe') + + Compiles a configuration that stops the processes with the executable + at the file paths 'C:\Windows\cmd.exe' and 'C:\TestPath\TestProcess.exe'. + + .EXAMPLE + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xProcessSet_StopProcessConfig' -Parameters @{ Path = @('C:\Windows\System32\cmd.exe', 'C:\TestPath\TestProcess.exe') } + + Compiles a configuration in Azure Automation that stop the processes + with the executable at the file paths 'C:\Windows\cmd.exe' + and 'C:\TestPath\TestProcess.exe'. + + Replace the and with correct values. +#> +Configuration xProcessSet_StopProcessConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String[]] + $Path + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xProcessSet 'StartProcess' + { + Path = $Path + Ensure = 'Absent' + StandardOutputPath = 'C:\Output.log' + } + } +} diff --git a/Examples/xRegistryResource_AddKeyConfig.ps1 b/Examples/xRegistryResource_AddKeyConfig.ps1 new file mode 100644 index 000000000..61d827388 --- /dev/null +++ b/Examples/xRegistryResource_AddKeyConfig.ps1 @@ -0,0 +1,58 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 116f2886-58c5-4355-b41a-c57e9a279991 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that creates a new registry key. + + .DESCRIPTION + Configuration that creates a new registry key called MyNewKey as a sub-key under + the key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'. + + .PARAMETER Path + The path to the key in the registry that should be created. + + .EXAMPLE + xRegistryResource_AddKeyConfig -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\MyNewKey' + + Compiles a configuration that creates a new registry key called MyNewKey under + the parent key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'. +#> +Configuration xRegistryResource_AddKeyConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Path + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xRegistry 'AddKey' + { + Key = $Path + Ensure = 'Present' + ValueName = '' + } + } +} diff --git a/Examples/xRegistryResource_AddOrModifyValueConfig.ps1 b/Examples/xRegistryResource_AddOrModifyValueConfig.ps1 new file mode 100644 index 000000000..a188c3d40 --- /dev/null +++ b/Examples/xRegistryResource_AddOrModifyValueConfig.ps1 @@ -0,0 +1,127 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID ae26837c-a553-4d19-86d9-cea511b73c74 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that creates a new registry key with a value. + + .DESCRIPTION + Configuration that creates a new registry key with a value. + + .PARAMETER Path + The path to the key in the registry that should be created or modified. + + .PARAMETER ValueName + The name of the registry value to set. To modify or remove the default + value of a registry key, specify this property as an empty string while + also specifying ValueType or ValueData. + + .PARAMETER ValueData + The data to set as the registry key value. + + .PARAMETER ValueType + The type of the value to set. Defaults to 'String'. + { String | Binary | DWord | QWord | MultiString | ExpandString } + + .PARAMETER Hex + Specifies whether or not the value data should be expressed in hexadecimal format. + If specified, DWORD/QWORD value data is presented in hexadecimal format. + Not valid for other value types. + The default value is $false. + + .PARAMETER OverwriteExisting + Specifies whether or not to overwrite the with the new value if the + registry key is already present. + The default value is $false. + + .EXAMPLE + xRegistryResource_AddOrModifyValueConfig -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -ValueName 'MyValue' -ValueType 'Binary' -ValueData @('0x00') -OverwriteExisting $true + + Compiles a configuration that creates a new registry value called MyValue under + the parent key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'. + + If the registry key value MyValue under the key + 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' + does not exist, then the key value is created with the Binary value 0, and + will then make sure that the value always exist and have the correct + value (make sure it is in desired state). + + .EXAMPLE + $configurationParameters = @{ + Path = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' + ValueName = 'MyValue' + ValueType = 'Binary' + ValueData = @('0x00') + OverwriteExisting = $true + } + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xRegistryResource_AddOrModifyValueConfig' -Parameters $configurationParameters + + Compiles a configuration in Azure Automation that that creates a new + registry value called MyValue under the parent key + 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'. + + Replace the and with correct values. +#> +Configuration xRegistryResource_AddOrModifyValueConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Path, + + [Parameter(Mandatory = $true)] + [AllowEmptyString()] + [System.String] + $ValueName, + + [Parameter()] + [System.String[]] + $ValueData, + + [Parameter()] + [ValidateSet('String', 'Binary', 'DWord', 'QWord', 'MultiString', 'ExpandString')] + [System.String] + $ValueType = 'String', + + [Parameter()] + [System.Boolean] + $HexValue, + + [Parameter()] + [System.Boolean] + $OverwriteExisting + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xRegistry 'AddOrModifyValue' + { + Key = $Path + Ensure = 'Present' + ValueName = $ValueName + ValueType = $ValueType + ValueData = $ValueData + Force = $OverwriteExisting + } + } +} diff --git a/Examples/xRegistryResource_RemoveKeyConfig.ps1 b/Examples/xRegistryResource_RemoveKeyConfig.ps1 new file mode 100644 index 000000000..6c533653b --- /dev/null +++ b/Examples/xRegistryResource_RemoveKeyConfig.ps1 @@ -0,0 +1,57 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID b5662461-5244-4ff7-ae79-df0a79eb3eb0 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that removes a registry key. + + .DESCRIPTION + Configuration that removes a registry key. + + .PARAMETER Path + The path to the key in the registry that should be removed. + + .EXAMPLE + xRegistryResource_AddKeyConfig -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\MyNewKey' + + Compiles a configuration that removes the registry key called MyNewKey under + the parent key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'. +#> +Configuration xRegistryResource_RemoveKeyConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Path + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xRegistry 'RemoveKey' + { + Key = $Path + Ensure = 'Absent' + ValueName = '' + } + } +} diff --git a/Examples/xRegistryResource_RemoveValueConfig.ps1 b/Examples/xRegistryResource_RemoveValueConfig.ps1 new file mode 100644 index 000000000..99061b1a7 --- /dev/null +++ b/Examples/xRegistryResource_RemoveValueConfig.ps1 @@ -0,0 +1,64 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 5d501d8e-4c4d-472f-ae46-7ef3962f1712 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that removes a registry value. + + .DESCRIPTION + Configuration that removes a registry value. + + .PARAMETER Path + The path to the key in the registry from which the value should be removed. + + .PARAMETER ValueName + The name of the value to remove. + + .EXAMPLE + xRegistryResource_RemoveValueConfig -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -ValueName 'MyValue' + + Compiles a configuration that removes the registry value MyValue from + the key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'. +#> +Configuration xRegistryResource_RemoveValueConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Path, + + [Parameter(Mandatory = $true)] + [System.String] + $ValueName + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xRegistry 'RemoveValue' + { + Key = $Path + Ensure = 'Absent' + ValueName = $ValueName + } + } +} diff --git a/Examples/xRemoteFile_DownloadFileConfig.ps1 b/Examples/xRemoteFile_DownloadFileConfig.ps1 new file mode 100644 index 000000000..1a73eafb5 --- /dev/null +++ b/Examples/xRemoteFile_DownloadFileConfig.ps1 @@ -0,0 +1,106 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID bf0cf053-65d3-4d1c-a1ca-762dd2b67f9b +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that downloads a file. + + .DESCRIPTION + Configuration that downloads a file. + + .PARAMETER NodeName + The names of one or more nodes to compile a configuration for. + Defaults to 'localhost'. + + .PARAMETER DestinationPath + The path where the remote file should be downloaded + + .PARAMETER Uri + The URI of the file which should be downloaded. It must be a HTTP, HTTPS + or FILE resource. + + .PARAMETER UserAgent + The user agent string for the web request. + + .PARAMETER Headers + The headers of the web request. + + .EXAMPLE + xRemoteFile_DownloadFileConfig -DestinationPath "$env:SystemDrive\fileName.jpg" -Uri 'http://www.contoso.com/image.jpg' -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer -Headers @{'Accept-Language' = 'en-US'} + + Compiles a configuration that downloads the file 'http://www.contoso.com/image.jpg' + to the local file "$env:SystemDrive\fileName.jpg". + + .EXAMPLE + $configurationParameters = @{ + DestinationPath = "$env:SystemDrive\fileName.jpg" + Uri = 'http://www.contoso.com/image.jpg' + UserAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer + Headers = @{ + 'Accept-Language' = 'en-US' + } + } + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xRemoteFile_DownloadFileConfig' -Parameters $configurationParameters + + Compiles a configuration in Azure Automation that downloads the file + 'http://www.contoso.com/image.jpg' to the local file + "$env:SystemDrive\fileName.jpg". + + Replace the and with correct values. +#> +configuration xRemoteFile_DownloadFileConfig +{ + param + ( + [Parameter()] + [System.String[]] + $NodeName = 'localhost', + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $DestinationPath, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Uri, + + [Parameter()] + [System.String] + $UserAgent, + + [Parameter()] + [System.Collections.Hashtable] + $Headers + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node $nodeName + { + xRemoteFile 'DownloadFileUsingProxy' + { + DestinationPath = $DestinationPath + Uri = $Uri + UserAgent = $UserAgent + Headers = $Headers + } + } +} diff --git a/Examples/xRemoteFile_DownloadFileUsingProxyConfig.ps1 b/Examples/xRemoteFile_DownloadFileUsingProxyConfig.ps1 new file mode 100644 index 000000000..9daa34432 --- /dev/null +++ b/Examples/xRemoteFile_DownloadFileUsingProxyConfig.ps1 @@ -0,0 +1,117 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID f57b22a3-b2bd-4fb5-9fa0-3997055d4577 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that downloads a file using proxy. + + .DESCRIPTION + Configuration that downloads a file using proxy. + + .PARAMETER NodeName + The names of one or more nodes to compile a configuration for. + Defaults to 'localhost'. + + .PARAMETER DestinationPath + The path where the remote file should be downloaded + + .PARAMETER Uri + The URI of the file which should be downloaded. It must be a HTTP, HTTPS + or FILE resource. + + .PARAMETER UserAgent + The user agent string for the web request. + + .PARAMETER Headers + The headers of the web request. + + .PARAMETER Proxy + The proxy server for the request, rather than connecting directly to the + Internet resource. Should be the URI of a network proxy server (e.g + 'http://10.20.30.1'). + + .EXAMPLE + xRemoteFile_DownloadFileUsingProxyConfig -DestinationPath "$env:SystemDrive\fileName.jpg" -Uri 'http://www.contoso.com/image.jpg' -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer -Headers @{'Accept-Language' = 'en-US'} -Proxy 'http://10.22.93.1' + + Compiles a configuration that downloads the file 'http://www.contoso.com/image.jpg', + using proxy 'http://10.22.93.1', to the local file "$env:SystemDrive\fileName.jpg". + + .EXAMPLE + $configurationParameters = @{ + DestinationPath = "$env:SystemDrive\fileName.jpg" + Uri = 'http://www.contoso.com/image.jpg' + UserAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer + Headers = @{ + 'Accept-Language' = 'en-US' + } + Proxy = 'http://10.22.93.1' + } + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xRemoteFile_DownloadFileUsingProxyConfig' -Parameters $configurationParameters + + Compiles a configuration in Azure Automation that downloads the file + 'http://www.contoso.com/image.jpg', using proxy 'http://10.22.93.1', to + the local file "$env:SystemDrive\fileName.jpg". + + Replace the and with correct values. +#> +configuration xRemoteFile_DownloadFileUsingProxyConfig +{ + param + ( + [Parameter()] + [System.String[]] + $NodeName = 'localhost', + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $DestinationPath, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Uri, + + [Parameter()] + [System.String] + $UserAgent, + + [Parameter()] + [System.Collections.Hashtable] + $Headers, + + [Parameter(Mandatory = $true)] + [System.String] + $Proxy + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node $nodeName + { + xRemoteFile 'DownloadFileUsingProxy' + { + DestinationPath = $DestinationPath + Uri = $Uri + UserAgent = $UserAgent + Headers = $Headers + Proxy = $Proxy + } + } +} diff --git a/Examples/xServiceSet_EnsureBuiltInAccountConfig.ps1 b/Examples/xServiceSet_EnsureBuiltInAccountConfig.ps1 new file mode 100644 index 000000000..d9810fe6d --- /dev/null +++ b/Examples/xServiceSet_EnsureBuiltInAccountConfig.ps1 @@ -0,0 +1,51 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID a9c46276-7e1e-431d-a95b-84282ab171db +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Sets the Secure Socket Tunneling Protocol and DHCP Client services to + run under the built-in account LocalService. + + .DESCRIPTION + Sets the Secure Socket Tunneling Protocol and DHCP Client services to + run under the built-in account LocalService. + + The current state of the services are ignored. + + .EXAMPLE + xServiceSet_EnsureBuiltInAccountConfig + + Compiles a configuration that sets the Secure Socket Tunneling Protocol + and DHCP Client services to run under the built-in account LocalService. +#> +Configuration xServiceSet_EnsureBuiltInAccountConfig +{ + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xServiceSet 'EnsureBuiltInAccount' + { + Name = @('SstpSvc', 'Dhcp') + Ensure = 'Present' + BuiltInAccount = 'LocalService' + State = 'Ignore' + } + } +} diff --git a/Examples/xServiceSet_StartServicesConfig.ps1 b/Examples/xServiceSet_StartServicesConfig.ps1 new file mode 100644 index 000000000..052c9594d --- /dev/null +++ b/Examples/xServiceSet_StartServicesConfig.ps1 @@ -0,0 +1,65 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID d8734507-59a8-4ad4-9716-7eb52362aee2 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that starts one or more services. + + .DESCRIPTION + Configuration that starts one or more services. + + .PARAMETER Name + The name of one or more the Windows services to start. + + .EXAMPLE + xServiceSet_StartServicesConfig -Name @('Dhcp', 'MpsSvc') + + Compiles a configuration that ensures that the DHCP Client and + Windows Firewall services are running. + + .EXAMPLE + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xServiceSet_StartServicesConfig' -Parameters @{ Name = @('Dhcp', 'MpsSvc') } + + Compiles a configuration in Azure Automation that ensures that the + DHCP Client and Windows Firewall services are running. + + Replace the and with correct values. +#> +Configuration xServiceSet_StartServicesConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String[]] + $Name + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xServiceSet 'StartServices' + { + Name = $Name + Ensure = 'Present' + State = 'Running' + } + } +} diff --git a/Examples/xService_ChangeServiceStateConfig.ps1 b/Examples/xService_ChangeServiceStateConfig.ps1 new file mode 100644 index 000000000..40a4d8d2b --- /dev/null +++ b/Examples/xService_ChangeServiceStateConfig.ps1 @@ -0,0 +1,66 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 7e8e91ba-ab33-4d7a-8b17-6fca60ccd040 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that changes the state for an existing service. + + .DESCRIPTION + Configuration that changes the state for an existing service. + + .PARAMETER Name + The name of the Windows service. + + .PARAMETER State + The state that the Windows service should have. + + .EXAMPLE + xService_ChangeServiceStateConfig -Name 'spooler' -State 'Stopped' + + Compiles a configuration that make sure the state for the Windows + service 'spooler' is 'Stopped'. If the service is running the + Windows service will be stopped. +#> +Configuration xService_ChangeServiceStateConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Name, + + [Parameter()] + [ValidateSet('Running', 'Stopped')] + [System.String] + $State = 'Running' + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xService 'ChangeServiceState' + { + Name = $Name + State = $State + Ensure = 'Present' + } + } +} diff --git a/Examples/xService_CreateServiceConfig.ps1 b/Examples/xService_CreateServiceConfig.ps1 new file mode 100644 index 000000000..edaca28b4 --- /dev/null +++ b/Examples/xService_CreateServiceConfig.ps1 @@ -0,0 +1,68 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 22b2e2d1-76cd-4f4c-b952-ec3b574b9751 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that creates a new Windows service from an executable. + + .DESCRIPTION + Configuration that creates a new Windows service from an executable. + The executable must be built to run as a Windows service. + + .PARAMETER Path + The path to the executable for the Windows service. + + .PARAMETER Name + The name of the Windows service to be created. + + .EXAMPLE + xService_CreateServiceConfig -Path 'C:\FilePath\MyServiceExecutable.exe' -Name 'Service1' + + Compiles a configuration that creates a new service with the name Service1 + using the executable path 'C:\FilePath\MyServiceExecutable.exe'. + If the service with the name Service1 already exists and the executable + path is different, then the executable will be changed for the service. + The service is started by default if it is not running already. +#> +Configuration xService_CreateServiceConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Path, + + [Parameter(Mandatory = $true)] + [System.String] + $Name + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xService 'CreateService' + { + Name = $Name + Ensure = 'Present' + Path = $Path + } + } +} diff --git a/Examples/xService_RemoveServiceConfig.ps1 b/Examples/xService_RemoveServiceConfig.ps1 new file mode 100644 index 000000000..631eeaae3 --- /dev/null +++ b/Examples/xService_RemoveServiceConfig.ps1 @@ -0,0 +1,56 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 6e48f4f6-5b67-4868-ba72-9732dc40ee98 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that stops and then removes a Windows service. + + .DESCRIPTION + Configuration that stops and then removes a Windows service. + + .PARAMETER Name + The name of the Windows service to be removed. + + .EXAMPLE + xService_RemoveServiceConfig -Name 'Service1' + + Compiles a configuration that stops and then removes the service with the + name Service1. +#> +Configuration xService_RemoveServiceConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Name + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xService 'RemoveService' + { + Name = $Name + Ensure = 'Absent' + } + } +} diff --git a/Examples/xUser_CreateUserConfig.ps1 b/Examples/xUser_CreateUserConfig.ps1 new file mode 100644 index 000000000..5ea233335 --- /dev/null +++ b/Examples/xUser_CreateUserConfig.ps1 @@ -0,0 +1,57 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID e694ded5-b732-4537-9df2-456f2374264e +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that creates a local user account using the given credentials. + + .DESCRIPTION + Configuration that creates a local user account using the given credentials. + + .PARAMETER Credential + Credentials to use to create the local user account. + + .EXAMPLE + xUser_CreateUserConfig -Credential (Get-Credential) + + Compiles a configuration that creates a local user account. +#> +Configuration xUser_CreateUserConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.Management.Automation.PSCredential] + [System.Management.Automation.Credential()] + $Credential + ) + + Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xUser 'CreateUserAccount' + { + Ensure = 'Present' + UserName = Split-Path -Path $Credential.UserName -Leaf + Password = $Credential + } + } +} diff --git a/Examples/xUser_CreateUserDetailedConfig.ps1 b/Examples/xUser_CreateUserDetailedConfig.ps1 new file mode 100644 index 000000000..da8a2184a --- /dev/null +++ b/Examples/xUser_CreateUserDetailedConfig.ps1 @@ -0,0 +1,127 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 3353a4c7-e6b0-4ca9-852d-86d0c4a3e9a5 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that creates a local user account using the given credentials. + + .DESCRIPTION + Configuration that creates a local user account using the given credentials. + + .PARAMETER Credential + Credentials to use to create the local user account. + + .PARAMETER FullName + Full name of the local user account. Defaults to the name passed in the credentials. + + .PARAMETER Description + Description of the local user account. Defaults to no description. + + .PARAMETER PasswordNeverExpires + To ensure that the password for this account will never expire, set this + property to $true, and set it to $false if the password will expire. + Defaults to $false. + + .PARAMETER PasswordChangeRequired + If the user must change the password at the next sign in. Set this + property to $true if the user must change the password. Defaults to + $false. + + .PARAMETER PasswordChangeNotAllowed + If the user can change the password. Set this property to $true to ensure + that the user cannot change the password, and set it to $false to allow + the user to change the password. Defaults to $false. + + .PARAMETER Disabled + If the account is enabled. Set this property to $true to ensure that + this account is disabled, and set it to $false to ensure that it is + enabled. Defaults to $false. + + .NOTES + If you want to create a user with minimal attributes, every parameter, + except username and password, can be deleted since they are optional. + + If the parameters are present then they will be evaluated to be in + desired state, meaning if for example Description parameter is left as + the default value, then the desired state is to have no description on + the local user account. + + .EXAMPLE + xUser_CreateUserDetailedConfig -Credential = (Get-Credential) -FullName = 'MyUser' -Description = 'My local user account' -PasswordNeverExpires = $true -PasswordChangeRequired = $false -PasswordChangeNotAllowed = $false -Disabled = $false + + Compiles a configuration that creates a local user account. +#> +Configuration xUser_CreateUserDetailedConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.Management.Automation.PSCredential] + [System.Management.Automation.Credential()] + $Credential, + + [Parameter()] + [System.String] + $FullName, + + [Parameter()] + [System.String] + $Description, + + [Parameter()] + [System.Boolean] + $PasswordNeverExpires, + + [Parameter()] + [System.Boolean] + $PasswordChangeRequired, + + [Parameter()] + [System.Boolean] + $PasswordChangeNotAllowed, + + [Parameter()] + [System.Boolean] + $Disabled + ) + + Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + if (-not $FullName) + { + $FullName = $Credential.UserName + } + + xUser 'CreateUserAccount' + { + Ensure = 'Present' + UserName = Split-Path -Path $Credential.UserName -Leaf + Password = $Credential + FullName = $FullName + Description = $Description + PasswordNeverExpires = $PasswordNeverExpires + PasswordChangeRequired = $PasswordChangeRequired + PasswordChangeNotAllowed = $PasswordChangeNotAllowed + Disabled = $Disabled + } + } +} diff --git a/Examples/xUser_RemoveUserConfig.ps1 b/Examples/xUser_RemoveUserConfig.ps1 new file mode 100644 index 000000000..b53b3f061 --- /dev/null +++ b/Examples/xUser_RemoveUserConfig.ps1 @@ -0,0 +1,55 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 87c4e4fa-7519-4838-b187-b6a2ff8d1a45 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that removes a local user account using the given username. + + .DESCRIPTION + Configuration that removes a local user account using the given username. + + .PARAMETER UserName + The username of the local user account to remove. + + .EXAMPLE + xUser_RemoveUserConfig -UserName 'MyUser' + + Compiles a configuration that removes a local user account. +#> +Configuration xUser_RemoveUserConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $UserName + ) + + Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xUser 'RemoveUserAccount' + { + Ensure = 'Absent' + UserName = $UserName + } + } +} diff --git a/Examples/xWindowsFeatureSet_AddFeaturesConfig.ps1 b/Examples/xWindowsFeatureSet_AddFeaturesConfig.ps1 new file mode 100644 index 000000000..b0aee11b3 --- /dev/null +++ b/Examples/xWindowsFeatureSet_AddFeaturesConfig.ps1 @@ -0,0 +1,73 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 923d8088-f7c0-4762-a958-197e3ffe8cf3 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that adds several roles or features. + + .DESCRIPTION + Configuration that adds several roles or features. The roles of features + will be installed using all sub-features, and logs the operation to the + file at 'C:\LogPath\Log.log'. + + .PARAMETER Name + One or more names of the roles or features that you want to ensure is + added. + This is the same as the Name parameter from the Get-WindowsFeature + cmdlet, and not the display name of the role or feature. + + .EXAMPLE + xWindowsFeatureSet_AddFeaturesConfig -Name @('Telnet-Client', 'RSAT-File-Services') + + Compiles a configuration that installs the Telnet-Client and + RSAT-File-Services Windows features, including all their sub-features. + Logs the operation to the file at 'C:\LogPath\Log.log'. + + .EXAMPLE + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xWindowsFeatureSet_AddFeaturesConfig' -Parameters @{ Name = @('Telnet-Client', 'RSAT-File-Services') } + + Compiles a configuration in Azure Automation that installs the + Telnet-Client and RSAT-File-Services Windows features, including all + their sub-features. Logs the operation to the file at 'C:\LogPath\Log.log'. + + Replace the and with correct values. +#> +Configuration xWindowsFeatureSet_AddFeaturesConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String[]] + $Name + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xWindowsFeatureSet 'AddFeatures' + { + Name = $Name + Ensure = 'Present' + IncludeAllSubFeature = $true + LogPath = 'C:\LogPath\Log.log' + } + } +} diff --git a/Examples/xWindowsFeatureSet_RemoveFeaturesConfig.ps1 b/Examples/xWindowsFeatureSet_RemoveFeaturesConfig.ps1 new file mode 100644 index 000000000..6a1667a28 --- /dev/null +++ b/Examples/xWindowsFeatureSet_RemoveFeaturesConfig.ps1 @@ -0,0 +1,73 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID a9adfe2f-d3cd-42ee-bc69-412adedd2745 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that removes several roles or features. + + .DESCRIPTION + Configuration that removes several roles or features. The roles of features + will be uninstalled together with all the sub-features, and logs the + operation to the file at 'C:\LogPath\Log.log'. + + .PARAMETER Name + One or more names of the roles or features that you want to ensure is + removed. + This is the same as the Name parameter from the Get-WindowsFeature + cmdlet, and not the display name of the role or feature. + + .EXAMPLE + xWindowsFeatureSet_RemoveFeaturesConfig -Name @('Telnet-Client', 'RSAT-File-Services') + + Compiles a configuration that uninstalls the Telnet-Client and + RSAT-File-Services Windows features, including all their sub-features. + Logs the operation to the file at 'C:\LogPath\Log.log'. + + .EXAMPLE + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xWindowsFeatureSet_RemoveFeaturesConfig' -Parameters @{ Name = @('Telnet-Client', 'RSAT-File-Services') } + + Compiles a configuration in Azure Automation that uninstalls the + Telnet-Client and RSAT-File-Services Windows features, including all + their sub-features. Logs the operation to the file at 'C:\LogPath\Log.log'. + + Replace the and with correct values. +#> +Configuration xWindowsFeatureSet_RemoveFeaturesConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String[]] + $Name + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xWindowsFeatureSet 'RemoveFeatures' + { + Name = $Name + Ensure = 'Absent' + IncludeAllSubFeature = $true + LogPath = 'C:\LogPath\Log.log' + } + } +} diff --git a/Examples/xWindowsFeature_AddFeatureConfig.ps1 b/Examples/xWindowsFeature_AddFeatureConfig.ps1 new file mode 100644 index 000000000..7322647bf --- /dev/null +++ b/Examples/xWindowsFeature_AddFeatureConfig.ps1 @@ -0,0 +1,68 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 2becfdf4-6679-47bb-9755-7ed2075607d6 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that adds a role or feature. + + .DESCRIPTION + Configuration that adds a role or feature. + + .PARAMETER Name + Name of the role or feature that you want to ensure is added. + This is the same as the Name parameter from the Get-WindowsFeature + cmdlet, and not the display name of the role or feature. + + .PARAMETER IncludeAllSubFeature + Set this parameter to $true to ensure the state of all required + sub-features with the state of the feature you specify with the Name + parameter. The default value is $false. + + .EXAMPLE + xWindowsFeature_AddFeatureConfig -Name 'Telnet-Client' -IncludeAllSubFeature $false + + Compiles a configuration that adds the feature Telnet-Client. +#> +Configuration xWindowsFeature_AddFeatureConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Name, + + [Parameter()] + [System.Boolean] + $IncludeAllSubFeature + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xWindowsFeature 'AddFeature' + { + Name = $Name + Ensure = 'Present' + IncludeAllSubFeature = $IncludeAllSubFeature + } + } +} + diff --git a/Examples/xWindowsFeature_AddFeatureUsingCredentialConfig.ps1 b/Examples/xWindowsFeature_AddFeatureUsingCredentialConfig.ps1 new file mode 100644 index 000000000..0dc0eb2e2 --- /dev/null +++ b/Examples/xWindowsFeature_AddFeatureUsingCredentialConfig.ps1 @@ -0,0 +1,76 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 725562ba-fa61-4976-be99-0cf3f04ffc6e +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that adds a role or feature, using the given credentials. + + .DESCRIPTION + Configuration that adds a role or feature, using the given credentials. + + .PARAMETER Name + Name of the role or feature that you want to ensure is added. + This is the same as the Name parameter from the Get-WindowsFeature + cmdlet, and not the display name of the role or feature. + + .PARAMETER Credential + The credentials to use to add or remove the role or feature. + + .PARAMETER IncludeAllSubFeature + Set this parameter to $true to ensure the state of all required + sub-features with the state of the feature you specify with the Name + parameter. The default value is $false. + + .EXAMPLE + xWindowsFeature_AddFeatureUsingCredentialConfig -Name 'Telnet-Client' -IncludeAllSubFeature $false -Credential (Get-Credential) + + Compiles a configuration that adds the feature Telnet-Client. +#> +Configuration xWindowsFeature_AddFeatureUsingCredentialConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Name, + + [Parameter()] + [System.Boolean] + $IncludeAllSubFeature, + + [Parameter(Mandatory = $true)] + [System.Management.Automation.PSCredential] + [System.Management.Automation.Credential()] + $Credential + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xWindowsFeature 'AddFeatureUsingCredential' + { + Name = $Name + Ensure = 'Present' + IncludeAllSubFeature = $IncludeAllSubFeature + Credential = $Credential + } + } +} diff --git a/Examples/xWindowsFeature_AddFeatureWithLogPathConfig.ps1 b/Examples/xWindowsFeature_AddFeatureWithLogPathConfig.ps1 new file mode 100644 index 000000000..b9f83c62c --- /dev/null +++ b/Examples/xWindowsFeature_AddFeatureWithLogPathConfig.ps1 @@ -0,0 +1,78 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID ea0e3b37-9a9e-4331-8dc6-f95ff353b3d4 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that adds a role or feature, and outputs a log to the + specified file. + + .DESCRIPTION + Configuration that adds a role or feature, and outputs a log to the + specified file. + + .PARAMETER Name + Name of the role or feature that you want to ensure is added. + This is the same as the Name parameter from the Get-WindowsFeature + cmdlet, and not the display name of the role or feature. + + .PARAMETER IncludeAllSubFeature + Set this parameter to $true to ensure the state of all required + sub-features with the state of the feature you specify with the Name + parameter. The default value is $false. + + .PARAMETER LogPath + The path to a log file to log the operation. + + .EXAMPLE + xWindowsFeature_AddFeatureWithLogPathConfig -Name 'Telnet-Client' -IncludeAllSubFeature $false -LogPath "$env:TEMP\windowsfeature.log" + + Compiles a configuration that adds the feature Telnet-Client. +#> +Configuration xWindowsFeature_AddFeatureWithLogPathConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Name, + + [Parameter(Mandatory = $true)] + [System.String] + $LogPath, + + [Parameter()] + [System.Boolean] + $IncludeAllSubFeature + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xWindowsFeature 'AddFeatureWithLogPath' + { + Name = $Name + Ensure = 'Present' + IncludeAllSubFeature = $IncludeAllSubFeature + LogPath = $LogPath + } + } +} + diff --git a/Examples/xWindowsFeature_RemoveFeatureConfig.ps1 b/Examples/xWindowsFeature_RemoveFeatureConfig.ps1 new file mode 100644 index 000000000..477c2e82b --- /dev/null +++ b/Examples/xWindowsFeature_RemoveFeatureConfig.ps1 @@ -0,0 +1,68 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 281e1f4d-d196-4d0c-9444-bc40ec6ff9de +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that removes a role or feature. + + .DESCRIPTION + Configuration that removes a role or feature. + + .PARAMETER Name + Name of the role or feature that you want to ensure is removed. + This is the same as the Name parameter from the Get-WindowsFeature + cmdlet, and not the display name of the role or feature. + + .PARAMETER IncludeAllSubFeature + Set this parameter to $true to ensure the state of all required + sub-features with the state of the feature you specify with the Name + parameter. The default value is $false. + + .EXAMPLE + xWindowsFeature_RemoveFeatureConfig -Name 'Telnet-Client' -IncludeAllSubFeature $false + + Compiles a configuration that adds the feature Telnet-Client. +#> +Configuration xWindowsFeature_RemoveFeatureConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Name, + + [Parameter()] + [System.Boolean] + $IncludeAllSubFeature + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xWindowsFeature 'RemoveFeature' + { + Name = $Name + Ensure = 'Absent' + IncludeAllSubFeature = $IncludeAllSubFeature + } + } +} + diff --git a/Examples/xWindowsOptionalFeatureSet_DisableConfig.ps1 b/Examples/xWindowsOptionalFeatureSet_DisableConfig.ps1 new file mode 100644 index 000000000..1ecceea70 --- /dev/null +++ b/Examples/xWindowsOptionalFeatureSet_DisableConfig.ps1 @@ -0,0 +1,82 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 0deebd0b-2e1a-4b4f-a5e7-d8264754fa51 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Disables one or more Windows optional features. + + .DESCRIPTION + Disables one or more Windows optional features with the specified name + and outputs a log to the specified path.When the optional feature is + disabled, the files associated with the feature will also be removed. + + .PARAMETER Name + The name of one or more Windows optional features to disable. + + .PARAMETER LogPath + The path to the file to log the disable operation to. + + .NOTES + Can only be run on Windows client operating systems and Windows Server 2012 or later. + The DISM PowerShell module must be available on the target machine. + + .EXAMPLE + xWindowsOptionalFeatureSet_DisableConfig -Name @('TelnetClient', 'LegacyComponents') -LogPath 'c:\log\feature.log' + + Compiles a configuration that disables the Windows optional features + TelnetClient and LegacyComponents and removes all files associated with + these features. Outputs a log of the operations to a file at the path + 'C:\LogPath\Log.txt'. + + .EXAMPLE + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xWindowsOptionalFeatureSet_DisableConfig' -Parameters @{ Name = @('TelnetClient', 'LegacyComponents'); LogPath = 'c:\log\feature.log' } + + Compiles a configuration in Azure Automation that that disables the + Windows optional features TelnetClient and LegacyComponents and removes + all files associated with these features. Outputs a log of the operations + to a file at the path 'C:\LogPath\Log.txt'. + + Replace the and with correct values. +#> +Configuration xWindowsOptionalFeatureSet_DisableConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [String[]] + $Name, + + [Parameter(Mandatory = $true)] + [String] + $LogPath + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xWindowsOptionalFeatureSet WindowsOptionalFeatureSet1 + { + Name = $Name + Ensure = 'Absent' + LogPath = $LogPath + RemoveFilesOnDisable = $true + } + } +} diff --git a/Examples/xWindowsOptionalFeatureSet_EnableConfig.ps1 b/Examples/xWindowsOptionalFeatureSet_EnableConfig.ps1 new file mode 100644 index 000000000..beb980768 --- /dev/null +++ b/Examples/xWindowsOptionalFeatureSet_EnableConfig.ps1 @@ -0,0 +1,79 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID a2793140-4351-4310-8062-edb2af9f4429 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Enables one or more Windows optional features. + + .DESCRIPTION + Enables one or more Windows optional features with the specified name and + outputs a log to the specified path. + + .PARAMETER Name + The name of one or more Windows optional features to enable. + + .PARAMETER LogPath + The path to the file to log the enable operation to. + + .NOTES + Can only be run on Windows client operating systems and Windows Server 2012 or later. + The DISM PowerShell module must be available on the target machine. + + .EXAMPLE + xWindowsOptionalFeatureSet_EnableConfig -Name @('MicrosoftWindowsPowerShellV2', 'Internet-Explorer-Optional-amd64') -LogPath 'c:\log\feature.log' + + Compiles a configuration that enables the Windows optional features + MicrosoftWindowsPowerShellV2 and Internet-Explorer-Optional-amd64 and + outputs a log of the operations to a file at the path 'C:\LogPath\Log.txt'. + + .EXAMPLE + Start-AzureRmAutomationDscCompilationJob -ResourceGroupName '' -AutomationAccountName '' -ConfigurationName 'xWindowsOptionalFeatureSet_EnableConfig' -Parameters @{ Name = @('MicrosoftWindowsPowerShellV2', 'Internet-Explorer-Optional-amd64'); LogPath = 'c:\log\feature.log' } + + Compiles a configuration in Azure Automation that that enables the + Windows optional features MicrosoftWindowsPowerShellV2 and + Internet-Explorer-Optional-amd64 and outputs a log of the operations to + a file at the path 'C:\LogPath\Log.txt'. + + Replace the and with correct values. +#> +Configuration xWindowsOptionalFeatureSet_EnableConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [String[]] + $Name, + + [Parameter(Mandatory = $true)] + [String] + $LogPath + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xWindowsOptionalFeatureSet WindowsOptionalFeatureSet1 + { + Name = $Name + Ensure = 'Present' + LogPath = $LogPath + } + } +} diff --git a/Examples/xWindowsOptionalFeature_DisableConfig.ps1 b/Examples/xWindowsOptionalFeature_DisableConfig.ps1 new file mode 100644 index 000000000..88d722366 --- /dev/null +++ b/Examples/xWindowsOptionalFeature_DisableConfig.ps1 @@ -0,0 +1,71 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 4671e4f7-7ba5-4736-8a29-d439db3d9bb7 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Disables a Windows optional feature. + + .DESCRIPTION + Disables the Windows optional feature with the specified name and outputs + a log to the specified path. When the optional feature is disabled, the + files associated with the feature will also be removed. + + .PARAMETER Name + The name of the Windows optional feature to disable. + + .PARAMETER LogPath + The path to the file to log the disable operation to. + + .NOTES + Can only be run on Windows client operating systems and Windows Server 2012 + or later. + The DISM PowerShell module must be available on the target machine. + + .EXAMPLE + xWindowsOptionalFeature_DisableConfig -Name 'SMB1Protocol' -LogPath 'c:\log\feature.log' + + Compiles a configuration that ensures that the SMB1Protocol optional + feature is disabled, and logs the operation to 'C:\log\feature.log'. +#> +Configuration xWindowsOptionalFeature_DisableConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [String] + $Name, + + [Parameter(Mandatory = $true)] + [String] + $LogPath + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xWindowsOptionalFeature 'DisableOptionalFeature' + { + Name = $Name + Ensure = 'Absent' + LogPath = $LogPath + RemoveFilesOnDisable = $true + } + } +} diff --git a/Examples/xWindowsOptionalFeature_EnableConfig.ps1 b/Examples/xWindowsOptionalFeature_EnableConfig.ps1 new file mode 100644 index 000000000..78537b461 --- /dev/null +++ b/Examples/xWindowsOptionalFeature_EnableConfig.ps1 @@ -0,0 +1,69 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 6fca965e-e3a2-4108-8385-d14bf2c4f0dc +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Enables a Windows optional feature. + + .DESCRIPTION + Enables the Windows optional feature with the specified name and outputs + a log to the specified path. + + .PARAMETER Name + The name of the Windows optional feature to enable. + + .PARAMETER LogPath + The path to the file to log the enable operation to. + + .NOTES + Can only be run on Windows client operating systems and Windows Server 2012 + or later. + The DISM PowerShell module must be available on the target machine. + + .EXAMPLE + xWindowsOptionalFeature_EnableConfig -Name 'TelnetClient' -LogPath 'c:\log\feature.log' + + Compiles a configuration that ensures that the Telnet Client optional + feature is enabled, and logs the operation to 'C:\log\feature.log'. +#> +Configuration xWindowsOptionalFeature_EnableConfig +{ + param + ( + [Parameter(Mandatory = $true)] + [String] + $Name, + + [Parameter(Mandatory = $true)] + [String] + $LogPath + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xWindowsOptionalFeature 'EnableOptionalFeature' + { + Name = $Name + Ensure = 'Present' + LogPath = $LogPath + } + } +} diff --git a/Examples/xWindowsPackageCab_InstallPackageConfig.ps1 b/Examples/xWindowsPackageCab_InstallPackageConfig.ps1 new file mode 100644 index 000000000..484117225 --- /dev/null +++ b/Examples/xWindowsPackageCab_InstallPackageConfig.ps1 @@ -0,0 +1,78 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 6f363fbb-2d4b-4f39-8cfb-4dbff4bd04f6 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Installs a package from the cab file. + + .DESCRIPTION + Installs a package from the cab file with the specified name from the + specified source path and outputs a log to the specified log path. + + .PARAMETER Name + The name of the package to install. + + .PARAMETER SourcePath + The path to the cab file to install the package from. + + .PARAMETER LogPath + The path to a file to log the install operation to. + + .NOTES + The DISM PowerShell module must be available on the target machine. + + .EXAMPLE + xWindowsPackageCab_InstallPackageConfig -Name 'MyPackage' -SourcePath 'C:\MyPackage.cab' -LogPath 'C:\Log\MyPackage.log' + + Compiles a configuration that installs a package named 'MyPackage' from + the path 'C:\MyPackage.cab', and logs the operation in 'C:\Log\MyPackage.log'. +#> +Configuration xWindowsPackageCab_InstallPackageConfig +{ + param + ( + [Parameter (Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Name, + + [Parameter (Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $SourcePath, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $LogPath + ) + + Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xWindowsPackageCab 'WindowsPackageCab' + { + Name = $Name + Ensure = 'Present' + SourcePath = $SourcePath + LogPath = $LogPath + } + } +} diff --git a/Examples/xWindowsProcess_StartProcessConfig.ps1 b/Examples/xWindowsProcess_StartProcessConfig.ps1 new file mode 100644 index 000000000..e52962fe6 --- /dev/null +++ b/Examples/xWindowsProcess_StartProcessConfig.ps1 @@ -0,0 +1,67 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 675c8d2d-f3b8-4715-a831-92591becd725 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that starts a process. + + .DESCRIPTION + Configuration that starts a process that is provided in the given file + path with the specified arguments. + + .PARAMETER FilePath + The path to the executable file to start. + + .PARAMETER Argument + The arguments for the process to start. Defaults to no argument. + + .EXAMPLE + xWindowsProcess_StartProcessConfig -FilePath 'C:\WINDOWS\system32\PING.EXE' -Argument '-t localhost' + + Compiles a configuration that starts a process that continuously ping + localhost, and monitors that the process 'ping' is always started. +#> +Configuration xWindowsProcess_StartProcessConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] + $FilePath, + + [Parameter()] + [ValidateNotNullOrEmpty()] + [String] + $Argument + ) + + Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xWindowsProcess 'StartProcess' + { + Path = $FilePath + Arguments = $Argument + Ensure = 'Present' + } + } +} diff --git a/Examples/xWindowsProcess_StartProcessUnderUserConfig.ps1 b/Examples/xWindowsProcess_StartProcessUnderUserConfig.ps1 new file mode 100644 index 000000000..97bf138f2 --- /dev/null +++ b/Examples/xWindowsProcess_StartProcessUnderUserConfig.ps1 @@ -0,0 +1,88 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 1bea33c0-38a6-4332-82b9-e1a1d40b56dc +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that starts a process under the given credential. + + .DESCRIPTION + Configuration that starts a process under the given credential, that is + provided in the given file path with the specified arguments. + + .PARAMETER FilePath + The path to the executable file to start. + + .PARAMETER Argument + The arguments for the process to start. Defaults to no argument. + + .PARAMETER Credential + Credential to start the process under. + + .NOTES + To use the sample(s) with credentials, see blog at: + http://blogs.msdn.com/b/powershell/archive/2014/01/31/want-to-secure-credentials-in-windows-powershell-desired-state-configuration.aspx + + .EXAMPLE + xWindowsProcess_StartProcessUnderUserConfig -FilePath 'C:\WINDOWS\system32\PING.EXE' -Argument '-t localhost' -Credential (Get-Credential) + + Compiles a configuration that starts a 'ping' process under the given + credential, that continuously ping localhost, and monitors that the + process 'ping' is always started. +#> +Configuration xWindowsProcess_StartProcessUnderUserConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] + $FilePath, + + [Parameter()] + [ValidateNotNullOrEmpty()] + [String] + $Argument, + + [Parameter(Mandatory = $true)] + [System.Management.Automation.PSCredential] + [System.Management.Automation.Credential()] + $Credential + ) + + Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xUser 'CreateUserAccount' + { + Ensure = 'Present' + UserName = Split-Path -Path $Credential.UserName -Leaf + Password = $Credential + } + + xWindowsProcess 'StartProcessUnderUser' + { + Path = $FilePath + Arguments = $Argument + Credential = $Credential + Ensure = 'Present' + } + } +} diff --git a/Examples/xWindowsProcess_StopProcessConfig.ps1 b/Examples/xWindowsProcess_StopProcessConfig.ps1 new file mode 100644 index 000000000..783f04a06 --- /dev/null +++ b/Examples/xWindowsProcess_StopProcessConfig.ps1 @@ -0,0 +1,72 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 6ee000de-f0c1-4aca-8423-33d35d3288e1 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that stops a process. + + .DESCRIPTION + Configuration that stops the process that is provided in the given file + path, where the argument matches, and if the process is running. + + .PARAMETER FilePath + The path to the executable file to (process) to stop. + + .PARAMETER Argument + The arguments for the process to stop. Defaults to no argument. + + .NOTES + The FilePath could be set to just the process name only if the number of + returned processed is less than or equal to 8. If more than 8 processes + are returned, another filter is used to optimize performance, and that + filter needs the full path to the executable file. + + .EXAMPLE + xWindowsProcess_StopProcessConfig -FilePath 'C:\WINDOWS\system32\PING.EXE' -Argument '-t localhost' + + Compiles a configuration that stops a 'ping' process if the process exist. +#> +Configuration xWindowsProcess_StopProcessConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] + $FilePath, + + [Parameter()] + [ValidateNotNullOrEmpty()] + [String] + $Argument + ) + + Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xWindowsProcess 'StopProcess' + { + Path = $FilePath + Arguments = $Argument + Ensure = 'Absent' + } + } +} diff --git a/Examples/xWindowsProcess_StopProcessUnderUserConfig.ps1 b/Examples/xWindowsProcess_StopProcessUnderUserConfig.ps1 new file mode 100644 index 000000000..1e3d13455 --- /dev/null +++ b/Examples/xWindowsProcess_StopProcessUnderUserConfig.ps1 @@ -0,0 +1,88 @@ +<#PSScriptInfo +.VERSION 1.0.0 +.GUID 73eb39e7-fdc0-4dae-af0e-0c1458d3c8c8 +.AUTHOR Microsoft Corporation +.COMPANYNAME Microsoft Corporation +.COPYRIGHT +.TAGS DSCConfiguration +.LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE +.PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration +.ICONURI +.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.REQUIREDSCRIPTS +.EXTERNALSCRIPTDEPENDENCIES +.RELEASENOTES First version. +.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core +#> + +#Requires -module @{ModuleName = 'xPSDesiredStateConfiguration';ModuleVersion = '8.2.0.0'} + +<# + .SYNOPSIS + Configuration that stops a process under the given credential. + + .DESCRIPTION + Configuration that stops the process under the given credential, that is + provided in the given file path, where the argument matches, and if the + process is running. + + .PARAMETER FilePath + The path to the executable file to (process) to stop. + + .PARAMETER Argument + The arguments for the process to stop. Defaults to no argument. + + .PARAMETER Credential + Credential that the process is running under. + + .NOTES + The FilePath could be set to just the process name only if the number of + returned processed is less than or equal to 8. If more than 8 processes + are returned, another filter is used to optimize performance, and that + filter needs the full path to the executable file. + + To use the sample(s) with credentials, see blog at: + http://blogs.msdn.com/b/powershell/archive/2014/01/31/want-to-secure-credentials-in-windows-powershell-desired-state-configuration.aspx + + .EXAMPLE + xWindowsProcess_StopProcessUnderUserConfig -FilePath 'C:\WINDOWS\system32\PING.EXE' -Argument '-t localhost' -Credential (Get-Credential) + + Compiles a configuration that stops a 'ping' process under the given + credential, if the process exist. +#> +Configuration xWindowsProcess_StopProcessUnderUserConfig +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] + $FilePath, + + [Parameter()] + [ValidateNotNullOrEmpty()] + [String] + $Argument, + + [Parameter(Mandatory = $true)] + [System.Management.Automation.PSCredential] + [System.Management.Automation.Credential()] + $Credential + ) + + Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' + + Node localhost + { + xWindowsProcess 'StopProcess' + { + Path = $FilePath + Arguments = $Argument + Credential = $Credential + Ensure = 'Absent' + } + } +} + + diff --git a/README.md b/README.md index cca8a1584..a88648e13 100644 --- a/README.md +++ b/README.md @@ -90,12 +90,12 @@ None #### Examples -* [Expand an archive without file validation](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xArchive_ExpandArchiveNoValidation.ps1) -* [Expand an archive under a credential without file validation](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xArchive_ExpandArchiveNoValidationCredential.ps1) -* [Expand an archive with default file validation and file overwrite allowed](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xArchive_ExpandArchiveDefaultValidationAndForce.ps1) -* [Expand an archive with SHA-256 file validation and file overwrite allowed](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xArchive_ExpandArchiveChecksumAndForce.ps1) -* [Remove an archive without file validation](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xArchive_RemoveArchiveNoValidation.ps1) -* [Remove an archive with SHA-256 file validation](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xArchive_RemoveArchiveChecksum.ps1) +* [Expand an archive without file validation](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xArchive_ExpandArchiveNoValidationConfig.ps1) +* [Expand an archive under a credential without file validation](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xArchive_ExpandArchiveNoValidationCredentialConfig.ps1) +* [Expand an archive with default file validation and file overwrite allowed](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xArchive_ExpandArchiveDefaultValidationAndForceConfig.ps1) +* [Expand an archive with SHA-256 file validation and file overwrite allowed](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xArchive_ExpandArchiveChecksumAndForceConfig.ps1) +* [Remove an archive without file validation](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xArchive_RemoveArchiveNoValidationConfig.ps1) +* [Remove an archive with SHA-256 file validation](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xArchive_RemoveArchiveChecksumConfig.ps1) ### xDscWebService @@ -139,8 +139,8 @@ None #### Examples -* [Remove members from a group](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xGroup_RemoveMembers.ps1) -* [Set the members of a group](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xGroup_SetMembers.ps1) +* [Remove members from a group](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xGroup_RemoveMembersConfig.ps1) +* [Set the members of a group](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xGroup_SetMembersConfig.ps1) ### xGroupSet @@ -167,7 +167,7 @@ None #### Examples -* [Add members to multiple groups](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xGroupSet_AddMembers.ps1) +* [Add members to multiple groups](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xGroupSet_AddMembersConfig.ps1) ### xWindowsProcess @@ -199,10 +199,10 @@ None #### Examples -* [Start a process](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xWindowsProcess_Start.ps1) -* [Stop a process](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xWindowsProcess_Stop.ps1) -* [Start a process under a user](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xWindowsProcess_StartUnderUser.ps1) -* [Stop a process under a user](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xWindowsProcess_StopUnderUser.ps1) +* [Start a process](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xWindowsProcess_StartProcessConfig.ps1) +* [Stop a process](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xWindowsProcess_StopProcessConfig.ps1) +* [Start a process under a user](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xWindowsProcess_StartProcessUnderUserConfig.ps1) +* [Stop a process under a user](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xWindowsProcess_StopProcessUnderUserConfig.ps1) ### xProcessSet @@ -236,8 +236,8 @@ The following parameters will be the same for each process in the set: #### Examples -* [Start multiple processes](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xProcessSet_Start.ps1) -* [Stop multiple processes](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xProcessSet_Stop.ps1) +* [Start multiple processes](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xProcessSet_StartProcessConfig.ps1) +* [Stop multiple processes](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xProcessSet_StopProcessConfig.ps1) ### xService @@ -270,8 +270,9 @@ None #### Examples -* [Create a service](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xService_CreateService.ps1) -* [Delete a service](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xService_DeleteService.ps1) +* [Create a service](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xService_CreateServiceConfig.ps1) +* [Delete a service](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xService_RemoveServiceConfig.ps1) +* [Change the state of a service to started or stopped](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xService_ChangeServiceStateConfig.ps1.ps1) * [Update startup type for a service, and ignoring the current state](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xService_UpdateStartupTypeIgnoreStateConfig.ps1) ### xServiceSet @@ -300,8 +301,8 @@ None #### Examples -* [Ensure that multiple services are running](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xServiceSet_StartServices.ps1) -* [Set multiple services to run under the built-in account LocalService](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xServiceSet_BuiltInAccount.ps1) +* [Ensure that multiple services are running](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xServiceSet_StartServicesConfig.ps1) +* [Set multiple services to run under the built-in account LocalService](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xServiceSet_EnsureBuiltInAccountConfig.ps1) ### xRemoteFile @@ -316,6 +317,11 @@ None * **ProxyCredential**: Specifies a user account that has permission to use the proxy server that is specified by the Proxy parameter. Optional. * **Ensure**: Says whether DestinationPath exists on the machine. It's a read only property. +#### Examples + +* [Download a file](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xRemoteFile_DownloadFileConfig.ps1) +* [Download a file using proxy](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xRemoteFile_DownloadFileUsingProxyConfig.ps1) + ### xPackage * **Ensure**: Ensures that the package is **Present** or **Absent**. @@ -334,6 +340,11 @@ None * **SignerThumbprint**: The certificate thumbprint that should match that of the package file's signing certificate. * **ServerCertificateValidationCallback**: A callback function to validate the server certificate. * **RunAsCredential**: Credential used to install the package on the local system. +* **CreateCheckRegValue**: If a registry value should be created. +* **InstalledCheckRegHive**: The hive in which to create the registry key. Defaults to 'LocalMachine'. { LocalMachine | CurrentUser } +* **InstalledCheckRegKey**: That path in the registry where the value should be created. +* **InstalledCheckRegValueName**: The name of the registry value to create. +* **InstalledCheckRegValueData**: The data that should be set to the registry value. ### Read-Only Properties from Get-TargetResource @@ -344,6 +355,43 @@ None * **Version**: Version of the package. * **Installed**: Is the package installed? +#### Examples + +* [Install an .exe using credentials](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xPackage_InstallExeUsingCredentialsConfig.ps1) +* [Install an .exe using credentials and using custom registry data to discover the package](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xPackage_InstallExeUsingCredentialsAndRegistryConfig.ps1) +* [Simple installer for an msi package that matches via the Name](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xPackage_InstallMsiConfig.ps1) +* [Simple installer for an msi package and matches based on the product id](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xPackage_InstallMsiUsingProductIdConfig.ps1) + +### xPSEndpoint (xPSSessionConfiguration) + +Creates and registers a new session configuration endpoint. + +* **Ensure**: Indicates if the session configuration is **Present** or **Absent**. +* **Name**: Specifies the name of the session configuration. +* **StartupScript**: Specifies the startup script for the configuration. Enter + the fully qualified path of a Windows PowerShell script. +* **RunAsCredential**: Specifies the credential for commands of this session + configuration. By default, commands run with the permissions of the current user. +* **SecurityDescriptorSDDL**: Specifies the Security Descriptor Definition + Language (SDDL) string for the configuration. This string determines the + permissions that are required to use the new session configuration. To use a + session configuration in a session, users must have at least Execute(Invoke) + permission for the configuration. +* **AccessMode**: Enables and disables the session configuration and determines + whether it can be used for remote or local sessions on the computer. The + default value is "Remote". { Local | *Remote* | Disabled } + +### Read-Only Properties from Get-TargetResource + +*None.* + +#### Examples + +* [Register a new session configuration endpoint with optional access mode](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xPSEndpoint_NewConfig.ps1) +* [Register a new session configuration endpoint with default values](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xPSEndpoint_NewWithDefaultsConfig.ps1) +* [Register a new session configuration endpoint with custom values](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xPSEndpoint_NewCustomConfig.ps1) +* [Removes an existing session configuration endpoint](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xPSEndpoint_RemoveConfig.ps1) + ### xMsiPackage Provides a mechanism to install and uninstall .msi packages. @@ -379,10 +427,9 @@ None #### Examples -* [Install the MSI file with the given ID at the given Path](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xMsiPackage_InstallPackageFromFile.ps1) -* [Uninstall the MSI file with the given ID at the given Path](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xMsiPackage_UninstallPackageFromFile.ps1) -* [Install the MSI file with the given ID at the given HTTP URL](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xMsiPackage_InstallPackageFromHttp.ps1) -* [Uninstall the MSI file with the given ID at the given HTTPS URL](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xMsiPackage_UnstallPackageFromHttps.ps1) +* [Install the MSI file with the given ID at the given file path or HTTP URL](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xMsiPackage_InstallPackageConfig.ps1) +* [Uninstall the MSI file with the given ID at the given Path](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xMsiPackage_UninstallPackageFromFileConfig.ps1) +* [Uninstall the MSI file with the given ID at the given HTTPS URL](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xMsiPackage_UninstallPackageFromHttpsConfig.ps1) ### xFileUpload @@ -391,6 +438,10 @@ None * **Credential**: PSCredential for the user with access to DestinationPath. * **CertificateThumbprint**: Thumbprint of the certificate which should be used for encryption/decryption. +#### Examples + +* [Upload file or folder to a SMB share](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xFileUpload_UploadToSMBShareConfig.ps1) + ### xEnvironment Provides a mechanism to configure and manage environment variables for a machine or process. @@ -413,10 +464,12 @@ None #### Examples -* [Create a non-path environment variable](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xEnvironment_CreateNonPathVariable.ps1) -* [Create or update a path environment variable](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xEnvironment_CreatePathVariable.ps1) -* [Remove an environment variable](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xEnvironment_Remove.ps1) +* [Create a regular (non-path) environment variable](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xEnvironment_CreateNonPathVariableConfig.ps1) +* [Create or update a path environment variable](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xEnvironment_AddMultiplePathsConfig.ps1) +* [Remove paths from a path environment variable](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xEnvironment_RemoveMultiplePathsConfig.ps1) +* [Remove an environment variable](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xEnvironment_RemoveVariableConfig.ps1) +xEnvironment_AddMultiplePaths ### xScript Provides a mechanism to run PowerShell script blocks on a target node. @@ -465,10 +518,10 @@ None #### Examples -* [Add a registry key](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xRegistryResource_AddKey.ps1) -* [Add or modify a registry key value](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xRegistryResource_AddOrModifyValue.ps1) -* [Remove a registry key value](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xRegistryResource_RemoveValue.ps1) -* [Remove a registry key](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xRegistryResource_RemoveKey.ps1) +* [Add a registry key](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xRegistryResource_AddKeyConfig.ps1) +* [Add or modify a registry key value](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xRegistryResource_AddOrModifyValueConfig.ps1) +* [Remove a registry key value](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xRegistryResource_RemoveValueConfig.ps1) +* [Remove a registry key](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xRegistryResource_RemoveKeyConfig.ps1) ### xUser @@ -502,7 +555,9 @@ None #### Examples -* [Create a new User](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xUser_CreateUser.ps1) +* [Create a new local user account](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xUser_CreateUserConfig.ps1) +* [Remove a local user account](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xUser_RemoveUserConfig.ps1) +* [Create a new detailed local user account](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xUser_CreateUserDetailedConfig.ps1) ### xWindowsFeature @@ -528,7 +583,10 @@ Provides a mechanism to install or uninstall Windows roles or features on a targ #### Examples -* [Install or uninstall a Windows feature](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xWindowsFeature.ps1) +* [Install a Windows feature](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xWindowsFeature_AddFeatureConfig.ps1) +* [Uninstall a Windows feature](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xWindowsFeature_RemoveFeatureConfig.ps1) +* [Install a Windows feature using credentials](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xWindowsFeature_AddFeatureUsingCredentialConfig.ps1) +* [Install a Windows feature, output the log to file](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xWindowsFeature_AddFeatureWithLogPathConfig.ps1) ### xWindowsFeatureSet @@ -554,8 +612,8 @@ Provides a mechanism to configure and manage multiple xWindowsFeature resources #### Examples -* [Install multiple Windows features](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xWindowsFeatureSet_Install.ps1) -* [Uninstall multiple Windows features](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xWindowsFeatureSet_Uninstall.ps1) +* [Install multiple Windows features](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xWindowsFeatureSet_AddFeaturesConfig.ps1) +* [Uninstall multiple Windows features](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xWindowsFeatureSet_RemoveFeaturesConfig.ps1) ### xWindowsOptionalFeature @@ -584,7 +642,8 @@ This resource works on Nano Server. #### Examples -* [Enable the specified windows optional feature and output logs to the specified path](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xWindowsOptionalFeature.ps1) +* [Enable the specified windows optional feature and output logs to the specified path](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xWindowsOptionalFeature_EnableConfig.ps1) +* [Disables the specified windows optional feature and output logs to the specified path](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xWindowsOptionalFeature_DisableConfig.ps1) ### xWindowsOptionalFeatureSet @@ -614,8 +673,8 @@ None #### Examples -* [Enable multiple features](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xWindowsOptionalFeatureSet_Enable.ps1) -* [Disable multiple features](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xWindowsOptionalFeatureSet_Disable.ps1) +* [Enable multiple features](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xWindowsOptionalFeatureSet_EnableConfig.ps1) +* [Disable multiple features](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xWindowsOptionalFeatureSet_DisableConfig.ps1) ### xWindowsPackageCab Provides a mechanism to install or uninstall a package from a windows cabinet (cab) file on a target node. @@ -638,7 +697,7 @@ None #### Examples -* [Install a cab file with the given name from the given path](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/Sample_xWindowsPackageCab.ps1) +* [Install a cab file with the given name from the given path](https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/Examples/xWindowsPackageCab_InstallPackageConfig.ps1) ## Functions @@ -668,6 +727,70 @@ Publishes a 'FileInfo' object(s) to the pullserver configuration repository. It * Renamed and updated examples to be able to publish them to PowerShell Gallery. * Sample\_xScript.ps1 → xScript\_WatchFileContentConfig.ps1 * Sample\_xService\_UpdateStartupTypeIgnoreState.ps1 → xService\_UpdateStartupTypeIgnoreStateConfig.ps1 + * Sample\_xWindowsProcess\_Start.ps1 → xWindowsProcess\_StartProcessConfig.ps1 + * Sample\_xWindowsProcess\_StartUnderUser.ps1 → xWindowsProcess\_StartProcessUnderUserConfig.ps1 + * Sample\_xWindowsProcess\_Stop.ps1 → xWindowsProcess\_StopProcessConfig.ps1 + * Sample\_xWindowsProcess\_StopUnderUser.ps1 → xWindowsProcess\_StopProcessUnderUserConfig.ps1 + * Sample\_xUser\_CreateUser.ps1.ps1 → xUser\_CreateUserConfig.ps1 + * Sample\_xUser\_Generic.ps1.ps1 → xUser\_CreateUserDetailedConfig.ps1 + * Sample\_xWindowsFeature.ps1 → xWindowsFeature\_AddFeatureConfig.ps1 + * Sample\_xWindowsFeatureSet\_Install.ps1 → xWindowsFeatureSet\_AddFeaturesConfig.ps1 + * Sample\_xWindowsFeatureSet\_Uninstall.ps1 → xWindowsFeatureSet\_RemoveFeaturesConfig.ps1 + * Sample\_xRegistryResource\_AddKey.ps1 → xRegistryResource\_AddKeyConfig.ps1 + * Sample\_xRegistryResource\_RemoveKey.ps1 → xRegistryResource\_RemoveKeyConfig.ps1 + * Sample\_xRegistryResource\_AddOrModifyValue.ps1 → xRegistryResource\_AddOrModifyValueConfig.ps1 + * Sample\_xRegistryResource\_RemoveValue.ps1 → xRegistryResource\_RemoveValueConfig.ps1 + * Sample\_xService\_CreateService.ps1 → xService\_CreateServiceConfig.ps1 + * Sample\_xService\_DeleteService.ps1 → xService\_RemoveServiceConfig.ps1 + * Sample\_xServiceSet\_StartServices.ps1 → xServiceSet\_StartServicesConfig.ps1 + * Sample\_xServiceSet\_BuiltInAccount → xServiceSet\_EnsureBuiltInAccountConfig.ps1 + * Sample\_xWindowsPackageCab → xWindowsPackageCab\_InstallPackageConfig + * Sample\_xWindowsOptionalFeature.ps1 → xWindowsOptionalFeature\_EnableConfig.ps1 + * Sample\_xWindowsOptionalFeatureSet\_Enable.ps1 → xWindowsOptionalFeatureSet\_EnableConfig.ps1 + * Sample\_xWindowsOptionalFeatureSet\_Disable.ps1 → xWindowsOptionalFeatureSet\_DisableConfig.ps1 + * Sample\_xRemoteFileUsingProxy.ps1 → xRemoteFile\_DownloadFileUsingProxyConfig.ps1 + * Sample\_xRemoteFile.ps1 → xRemoteFile\_DownloadFileConfig.ps1 + * Sample\_xProcessSet\_Start.ps1 → xProcessSet\_StartProcessConfig.ps1 + * Sample\_xProcessSet\_Stop.ps1 → xProcessSet\_StopProcessConfig.ps1 + * Sample\_xMsiPackage\_UninstallPackageFromHttps.ps1 → xMsiPackage\_UninstallPackageFromHttpsConfig.ps1 + * Sample\_xMsiPackage\_UninstallPackageFromFile.ps1 → xMsiPackage\_UninstallPackageFromFileConfig.ps1 + * Sample\_xMsiPackage\_InstallPackageFromFile → xMsiPackage\_InstallPackageConfig.ps1 + * Sample\_xGroup\_SetMembers.ps1 → xGroup\_SetMembersConfig.ps1 + * Sample\_xGroup\_RemoveMembers.ps1 → xGroup\_RemoveMembersConfig.ps1 + * Sample\_xGroupSet\_AddMembers.ps1 → xGroupSet\_AddMembersConfig.ps1 + * Sample\_xFileUpload.ps1 → xFileUpload\_UploadToSMBShareConfig.ps1 + * Sample\_xEnvironment\_CreateMultiplePathVariables.ps1 → xEnvironment\_AddMultiplePathsConfig.ps1 + * Sample\_xEnvironment\_RemovePathVariables.ps1 → xEnvironment\_RemoveMultiplePathsConfig.ps1 + * Sample\_xEnvironment\_CreateNonPathVariable.ps1 → xEnvironment\_CreateNonPathVariableConfig.ps1 + * Sample\_xEnvironment\_Remove.ps1 → xEnvironment\_RemoveVariableConfig.ps1 + * Sample\_xArchive\_ExpandArchiveChecksumAndForce.ps1 → xArchive\_ExpandArchiveChecksumAndForceConfig.ps1 + * Sample\_xArchive\_ExpandArchiveDefaultValidationAndForce.ps1 → xArchive\_ExpandArchiveDefaultValidationAndForceConfig.ps1 + * Sample\_xArchive\_ExpandArchiveNoValidation.ps1 → xArchive\_ExpandArchiveNoValidationConfig.ps1 + * Sample\_xArchive\_ExpandArchiveNoValidationCredential.ps1 → xArchive\_ExpandArchiveNoValidationCredentialConfig.ps1 + * Sample\_xArchive\_RemoveArchiveChecksum.ps1 → xArchive\_RemoveArchiveChecksumConfig.ps1 + * Sample\_xArchive\_RemoveArchiveNoValidation.ps1 → xArchive\_RemoveArchiveNoValidationConfig.ps1 + * Sample\_InstallExeCreds\_xPackage.ps1 → xPackage\_InstallExeUsingCredentialsConfig.ps1 + * Sample\_InstallExeCredsRegistry\_xPackage.ps1 → xPackage\_InstallExeUsingCredentialsAndRegistryConfig.ps1 + * Sample\_InstallMSI\_xPackage.ps1 → xPackage\_InstallMsiConfig.ps1 + * Sample\_InstallMSIProductId\_xPackage.ps1 → xPackage\_InstallMsiUsingProductIdConfig.ps1 +* New examples + * xUser\_RemoveUserConfig.ps1 + * xWindowsFeature\_AddFeatureUsingCredentialConfig.ps1 + * xWindowsFeature\_AddFeatureWithLogPathConfig.ps1 + * xWindowsFeature\_RemoveFeatureConfig.ps1 + * xService\_ChangeServiceStateConfig.ps1 + * xWindowsOptionalFeature\_DisableConfig.ps1 + * xPSEndpoint\_NewConfig.ps1 + * xPSEndpoint\_NewWithDefaultsConfig.ps1 + * xPSEndpoint\_RemoveConfig.ps1 + * xPSEndpoint\_NewCustomConfig.ps1 +* Removed examples + * Sample\_xPSSessionConfiguration.ps1 - This file was split up in several examples, + those starting with 'xPSEndpoint*'. + * Sample\_xMsiPackage\_InstallPackageFromHttp - This was added to the example + xMsiPackage\_InstallPackageConfig.ps1 so the example sows either URI scheme. + * Sample\_xEnvironment\_CreatePathVariable.ps1 - Same as the new example + xEnvironment\_AddMultiplePaths.ps1 ### 8.3.0.0 From 933025829189140e31802fa92f58dfae7c5056f6 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Fri, 13 Jul 2018 13:16:38 +0200 Subject: [PATCH 7/9] Update examples to correctly register dependencies (#433) --- Examples/xArchive_ExpandArchiveChecksumAndForceConfig.ps1 | 4 ++-- .../xArchive_ExpandArchiveDefaultValidationAndForceConfig.ps1 | 4 ++-- Examples/xArchive_ExpandArchiveNoValidationConfig.ps1 | 4 ++-- .../xArchive_ExpandArchiveNoValidationCredentialConfig.ps1 | 4 ++-- Examples/xArchive_RemoveArchiveChecksumConfig.ps1 | 4 ++-- Examples/xArchive_RemoveArchiveNoValidationConfig.ps1 | 4 ++-- Examples/xEnvironment_AddMultiplePathsConfig.ps1 | 4 ++-- Examples/xEnvironment_CreateNonPathVariableConfig.ps1 | 4 ++-- Examples/xEnvironment_RemoveMultiplePathsConfig.ps1 | 4 ++-- Examples/xEnvironment_RemoveVariableConfig.ps1 | 4 ++-- Examples/xFileUpload_UploadToSMBShareConfig.ps1 | 4 ++-- Examples/xGroupSet_AddMembersConfig.ps1 | 4 ++-- Examples/xGroup_RemoveMembersConfig.ps1 | 4 ++-- Examples/xGroup_SetMembersConfig.ps1 | 4 ++-- Examples/xMsiPackage_InstallPackageConfig.ps1 | 4 ++-- Examples/xMsiPackage_UninstallPackageFromFileConfig.ps1 | 4 ++-- Examples/xMsiPackage_UninstallPackageFromHttpsConfig.ps1 | 4 ++-- Examples/xPSEndpoint_NewConfig.ps1 | 4 ++-- Examples/xPSEndpoint_NewCustomConfig.ps1 | 4 ++-- Examples/xPSEndpoint_NewWithDefaultsConfig.ps1 | 4 ++-- Examples/xPSEndpoint_RemoveConfig.ps1 | 4 ++-- .../xPackage_InstallExeUsingCredentialsAndRegistryConfig.ps1 | 4 ++-- Examples/xPackage_InstallExeUsingCredentialsConfig.ps1 | 4 ++-- Examples/xPackage_InstallMsiConfig.ps1 | 4 ++-- Examples/xPackage_InstallMsiUsingProductIdConfig.ps1 | 4 ++-- Examples/xProcessSet_StartProcessConfig.ps1 | 4 ++-- Examples/xProcessSet_StopProcessConfig.ps1 | 4 ++-- Examples/xRegistryResource_AddKeyConfig.ps1 | 4 ++-- Examples/xRegistryResource_AddOrModifyValueConfig.ps1 | 4 ++-- Examples/xRegistryResource_RemoveKeyConfig.ps1 | 4 ++-- Examples/xRegistryResource_RemoveValueConfig.ps1 | 4 ++-- Examples/xRemoteFile_DownloadFileConfig.ps1 | 4 ++-- Examples/xRemoteFile_DownloadFileUsingProxyConfig.ps1 | 4 ++-- Examples/xScript_WatchFileContentConfig.ps1 | 4 ++-- Examples/xServiceSet_EnsureBuiltInAccountConfig.ps1 | 4 ++-- Examples/xServiceSet_StartServicesConfig.ps1 | 4 ++-- Examples/xService_ChangeServiceStateConfig.ps1 | 4 ++-- Examples/xService_CreateServiceConfig.ps1 | 4 ++-- Examples/xService_RemoveServiceConfig.ps1 | 4 ++-- Examples/xService_UpdateStartupTypeIgnoreStateConfig.ps1 | 4 ++-- Examples/xUser_CreateUserConfig.ps1 | 4 ++-- Examples/xUser_CreateUserDetailedConfig.ps1 | 4 ++-- Examples/xUser_RemoveUserConfig.ps1 | 4 ++-- Examples/xWindowsFeatureSet_AddFeaturesConfig.ps1 | 4 ++-- Examples/xWindowsFeatureSet_RemoveFeaturesConfig.ps1 | 4 ++-- Examples/xWindowsFeature_AddFeatureConfig.ps1 | 4 ++-- Examples/xWindowsFeature_AddFeatureUsingCredentialConfig.ps1 | 4 ++-- Examples/xWindowsFeature_AddFeatureWithLogPathConfig.ps1 | 4 ++-- Examples/xWindowsFeature_RemoveFeatureConfig.ps1 | 4 ++-- Examples/xWindowsOptionalFeatureSet_DisableConfig.ps1 | 4 ++-- Examples/xWindowsOptionalFeatureSet_EnableConfig.ps1 | 4 ++-- Examples/xWindowsOptionalFeature_DisableConfig.ps1 | 4 ++-- Examples/xWindowsOptionalFeature_EnableConfig.ps1 | 4 ++-- Examples/xWindowsPackageCab_InstallPackageConfig.ps1 | 4 ++-- Examples/xWindowsProcess_StartProcessConfig.ps1 | 4 ++-- Examples/xWindowsProcess_StartProcessUnderUserConfig.ps1 | 4 ++-- Examples/xWindowsProcess_StopProcessConfig.ps1 | 4 ++-- Examples/xWindowsProcess_StopProcessUnderUserConfig.ps1 | 4 ++-- 58 files changed, 116 insertions(+), 116 deletions(-) diff --git a/Examples/xArchive_ExpandArchiveChecksumAndForceConfig.ps1 b/Examples/xArchive_ExpandArchiveChecksumAndForceConfig.ps1 index 5cd3b117d..2f153a7a2 100644 --- a/Examples/xArchive_ExpandArchiveChecksumAndForceConfig.ps1 +++ b/Examples/xArchive_ExpandArchiveChecksumAndForceConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 2e89ea6a-3911-4305-837e-73f2bf331b87 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xArchive_ExpandArchiveDefaultValidationAndForceConfig.ps1 b/Examples/xArchive_ExpandArchiveDefaultValidationAndForceConfig.ps1 index b6ff2ec4e..869183b27 100644 --- a/Examples/xArchive_ExpandArchiveDefaultValidationAndForceConfig.ps1 +++ b/Examples/xArchive_ExpandArchiveDefaultValidationAndForceConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID f064901d-086a-410c-8b2a-d0e471b8eddb .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xArchive_ExpandArchiveNoValidationConfig.ps1 b/Examples/xArchive_ExpandArchiveNoValidationConfig.ps1 index 557e6f096..b44b5558e 100644 --- a/Examples/xArchive_ExpandArchiveNoValidationConfig.ps1 +++ b/Examples/xArchive_ExpandArchiveNoValidationConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 635a3105-b4bc-482c-a5f2-ebe7127fd671 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xArchive_ExpandArchiveNoValidationCredentialConfig.ps1 b/Examples/xArchive_ExpandArchiveNoValidationCredentialConfig.ps1 index 6c30ea699..cc1ba128f 100644 --- a/Examples/xArchive_ExpandArchiveNoValidationCredentialConfig.ps1 +++ b/Examples/xArchive_ExpandArchiveNoValidationCredentialConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 36eb8f8c-e34c-4ec5-be10-8936b415a9a1 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xArchive_RemoveArchiveChecksumConfig.ps1 b/Examples/xArchive_RemoveArchiveChecksumConfig.ps1 index e98b8fa8b..292cce922 100644 --- a/Examples/xArchive_RemoveArchiveChecksumConfig.ps1 +++ b/Examples/xArchive_RemoveArchiveChecksumConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 662aee36-85dd-47fc-88e8-73d7b4e5f822 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xArchive_RemoveArchiveNoValidationConfig.ps1 b/Examples/xArchive_RemoveArchiveNoValidationConfig.ps1 index 9e029cd51..9da8a6928 100644 --- a/Examples/xArchive_RemoveArchiveNoValidationConfig.ps1 +++ b/Examples/xArchive_RemoveArchiveNoValidationConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 550a8fae-2a63-49b9-aec2-e31e6fd82135 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xEnvironment_AddMultiplePathsConfig.ps1 b/Examples/xEnvironment_AddMultiplePathsConfig.ps1 index 29d9ee027..5ef4d688b 100644 --- a/Examples/xEnvironment_AddMultiplePathsConfig.ps1 +++ b/Examples/xEnvironment_AddMultiplePathsConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID dafafad2-d581-4db2-841c-7095c5c3ed30 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xEnvironment_CreateNonPathVariableConfig.ps1 b/Examples/xEnvironment_CreateNonPathVariableConfig.ps1 index f4668c8b2..439afed32 100644 --- a/Examples/xEnvironment_CreateNonPathVariableConfig.ps1 +++ b/Examples/xEnvironment_CreateNonPathVariableConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID ee586cfa-237c-4e5f-929e-9b420afabc91 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xEnvironment_RemoveMultiplePathsConfig.ps1 b/Examples/xEnvironment_RemoveMultiplePathsConfig.ps1 index 7767168ca..3e299d6b4 100644 --- a/Examples/xEnvironment_RemoveMultiplePathsConfig.ps1 +++ b/Examples/xEnvironment_RemoveMultiplePathsConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID c24aa186-1765-4d8a-9204-14624e7b7f8a .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xEnvironment_RemoveVariableConfig.ps1 b/Examples/xEnvironment_RemoveVariableConfig.ps1 index c878f1917..a585f0716 100644 --- a/Examples/xEnvironment_RemoveVariableConfig.ps1 +++ b/Examples/xEnvironment_RemoveVariableConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 845b267f-e47e-4305-88b6-d1086e6c1405 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xFileUpload_UploadToSMBShareConfig.ps1 b/Examples/xFileUpload_UploadToSMBShareConfig.ps1 index 477c765fb..c401f07e1 100644 --- a/Examples/xFileUpload_UploadToSMBShareConfig.ps1 +++ b/Examples/xFileUpload_UploadToSMBShareConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 4b9e3719-034a-4f3e-aa48-321cc242fa9e .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xGroupSet_AddMembersConfig.ps1 b/Examples/xGroupSet_AddMembersConfig.ps1 index 0572d915d..b87c2ac05 100644 --- a/Examples/xGroupSet_AddMembersConfig.ps1 +++ b/Examples/xGroupSet_AddMembersConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID db98d037-c170-43cc-a716-da521731e84f .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xGroup_RemoveMembersConfig.ps1 b/Examples/xGroup_RemoveMembersConfig.ps1 index e5fcfdb18..d0c18c640 100644 --- a/Examples/xGroup_RemoveMembersConfig.ps1 +++ b/Examples/xGroup_RemoveMembersConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 84717cb3-a5d9-41dd-82c3-32b3068502f2 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xGroup_SetMembersConfig.ps1 b/Examples/xGroup_SetMembersConfig.ps1 index 3e161812e..bc02958ca 100644 --- a/Examples/xGroup_SetMembersConfig.ps1 +++ b/Examples/xGroup_SetMembersConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 8662bf80-5818-463b-8954-daf8a79525e7 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xMsiPackage_InstallPackageConfig.ps1 b/Examples/xMsiPackage_InstallPackageConfig.ps1 index f1eeba7a0..a07e0207a 100644 --- a/Examples/xMsiPackage_InstallPackageConfig.ps1 +++ b/Examples/xMsiPackage_InstallPackageConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 58632bf6-5a7f-4a85-bca6-59795c8aa801 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xMsiPackage_UninstallPackageFromFileConfig.ps1 b/Examples/xMsiPackage_UninstallPackageFromFileConfig.ps1 index 3f1a94aa7..f20534525 100644 --- a/Examples/xMsiPackage_UninstallPackageFromFileConfig.ps1 +++ b/Examples/xMsiPackage_UninstallPackageFromFileConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 33aa3450-fa8a-4eb7-9291-c0d374e7778e .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xMsiPackage_UninstallPackageFromHttpsConfig.ps1 b/Examples/xMsiPackage_UninstallPackageFromHttpsConfig.ps1 index ae4119cd2..9c528de18 100644 --- a/Examples/xMsiPackage_UninstallPackageFromHttpsConfig.ps1 +++ b/Examples/xMsiPackage_UninstallPackageFromHttpsConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 6492da05-37f4-47c3-9c72-19da8983dfa0 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xPSEndpoint_NewConfig.ps1 b/Examples/xPSEndpoint_NewConfig.ps1 index a0c7e7388..d29f3b2ae 100644 --- a/Examples/xPSEndpoint_NewConfig.ps1 +++ b/Examples/xPSEndpoint_NewConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID f7ec2dc4-ee13-4aba-b475-879661bff837 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xPSEndpoint_NewCustomConfig.ps1 b/Examples/xPSEndpoint_NewCustomConfig.ps1 index 5865e5b7b..5b06a0ba0 100644 --- a/Examples/xPSEndpoint_NewCustomConfig.ps1 +++ b/Examples/xPSEndpoint_NewCustomConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID b6c3a531-1727-4c11-b0d0-162073e09933 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xPSEndpoint_NewWithDefaultsConfig.ps1 b/Examples/xPSEndpoint_NewWithDefaultsConfig.ps1 index e7f078886..bd6c3117a 100644 --- a/Examples/xPSEndpoint_NewWithDefaultsConfig.ps1 +++ b/Examples/xPSEndpoint_NewWithDefaultsConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID be206016-df05-4f2d-8e5a-9bf9416ac33d .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xPSEndpoint_RemoveConfig.ps1 b/Examples/xPSEndpoint_RemoveConfig.ps1 index cd11a9150..aea73d4a2 100644 --- a/Examples/xPSEndpoint_RemoveConfig.ps1 +++ b/Examples/xPSEndpoint_RemoveConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 6a28a133-9d81-451b-a07f-eb9c61b4d283 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xPackage_InstallExeUsingCredentialsAndRegistryConfig.ps1 b/Examples/xPackage_InstallExeUsingCredentialsAndRegistryConfig.ps1 index 94cb14445..dfa2f9d69 100644 --- a/Examples/xPackage_InstallExeUsingCredentialsAndRegistryConfig.ps1 +++ b/Examples/xPackage_InstallExeUsingCredentialsAndRegistryConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 98e37dfd-cefb-4de6-8485-2ed8e5ca8959 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xPackage_InstallExeUsingCredentialsConfig.ps1 b/Examples/xPackage_InstallExeUsingCredentialsConfig.ps1 index e23a84a86..8618ae75e 100644 --- a/Examples/xPackage_InstallExeUsingCredentialsConfig.ps1 +++ b/Examples/xPackage_InstallExeUsingCredentialsConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID b89e163c-48d0-4038-aecd-8c759cfee61e .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xPackage_InstallMsiConfig.ps1 b/Examples/xPackage_InstallMsiConfig.ps1 index 5b606f665..47c78c329 100644 --- a/Examples/xPackage_InstallMsiConfig.ps1 +++ b/Examples/xPackage_InstallMsiConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 596fd9ca-7c00-4aa3-8efc-8e77c96942bf .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xPackage_InstallMsiUsingProductIdConfig.ps1 b/Examples/xPackage_InstallMsiUsingProductIdConfig.ps1 index 6443fe53b..444a3d419 100644 --- a/Examples/xPackage_InstallMsiUsingProductIdConfig.ps1 +++ b/Examples/xPackage_InstallMsiUsingProductIdConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID fd8e2fd1-7539-4d6c-a203-e88a99e7195d .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xProcessSet_StartProcessConfig.ps1 b/Examples/xProcessSet_StartProcessConfig.ps1 index 3879b62a2..f9bdab0f5 100644 --- a/Examples/xProcessSet_StartProcessConfig.ps1 +++ b/Examples/xProcessSet_StartProcessConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID c95c81b4-0e63-495c-8bc0-4a106931c463 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xProcessSet_StopProcessConfig.ps1 b/Examples/xProcessSet_StopProcessConfig.ps1 index 408fe7e58..bcd9f36c8 100644 --- a/Examples/xProcessSet_StopProcessConfig.ps1 +++ b/Examples/xProcessSet_StopProcessConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 215fd763-50ac-4b04-94cd-b125d6ba86d0 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xRegistryResource_AddKeyConfig.ps1 b/Examples/xRegistryResource_AddKeyConfig.ps1 index 61d827388..cd6d3f534 100644 --- a/Examples/xRegistryResource_AddKeyConfig.ps1 +++ b/Examples/xRegistryResource_AddKeyConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 116f2886-58c5-4355-b41a-c57e9a279991 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xRegistryResource_AddOrModifyValueConfig.ps1 b/Examples/xRegistryResource_AddOrModifyValueConfig.ps1 index a188c3d40..22c70972d 100644 --- a/Examples/xRegistryResource_AddOrModifyValueConfig.ps1 +++ b/Examples/xRegistryResource_AddOrModifyValueConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID ae26837c-a553-4d19-86d9-cea511b73c74 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xRegistryResource_RemoveKeyConfig.ps1 b/Examples/xRegistryResource_RemoveKeyConfig.ps1 index 6c533653b..e93faab0d 100644 --- a/Examples/xRegistryResource_RemoveKeyConfig.ps1 +++ b/Examples/xRegistryResource_RemoveKeyConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID b5662461-5244-4ff7-ae79-df0a79eb3eb0 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xRegistryResource_RemoveValueConfig.ps1 b/Examples/xRegistryResource_RemoveValueConfig.ps1 index 99061b1a7..4898b83f0 100644 --- a/Examples/xRegistryResource_RemoveValueConfig.ps1 +++ b/Examples/xRegistryResource_RemoveValueConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 5d501d8e-4c4d-472f-ae46-7ef3962f1712 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xRemoteFile_DownloadFileConfig.ps1 b/Examples/xRemoteFile_DownloadFileConfig.ps1 index 1a73eafb5..e0656ec31 100644 --- a/Examples/xRemoteFile_DownloadFileConfig.ps1 +++ b/Examples/xRemoteFile_DownloadFileConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID bf0cf053-65d3-4d1c-a1ca-762dd2b67f9b .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xRemoteFile_DownloadFileUsingProxyConfig.ps1 b/Examples/xRemoteFile_DownloadFileUsingProxyConfig.ps1 index 9daa34432..d0397aa47 100644 --- a/Examples/xRemoteFile_DownloadFileUsingProxyConfig.ps1 +++ b/Examples/xRemoteFile_DownloadFileUsingProxyConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID f57b22a3-b2bd-4fb5-9fa0-3997055d4577 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xScript_WatchFileContentConfig.ps1 b/Examples/xScript_WatchFileContentConfig.ps1 index 2dfc450d0..bc3098635 100644 --- a/Examples/xScript_WatchFileContentConfig.ps1 +++ b/Examples/xScript_WatchFileContentConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID f9306ebe-8af5-4dee-baf3-f3fac17891db .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xServiceSet_EnsureBuiltInAccountConfig.ps1 b/Examples/xServiceSet_EnsureBuiltInAccountConfig.ps1 index d9810fe6d..29519ade8 100644 --- a/Examples/xServiceSet_EnsureBuiltInAccountConfig.ps1 +++ b/Examples/xServiceSet_EnsureBuiltInAccountConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID a9c46276-7e1e-431d-a95b-84282ab171db .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xServiceSet_StartServicesConfig.ps1 b/Examples/xServiceSet_StartServicesConfig.ps1 index 052c9594d..683f2dc08 100644 --- a/Examples/xServiceSet_StartServicesConfig.ps1 +++ b/Examples/xServiceSet_StartServicesConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID d8734507-59a8-4ad4-9716-7eb52362aee2 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xService_ChangeServiceStateConfig.ps1 b/Examples/xService_ChangeServiceStateConfig.ps1 index 40a4d8d2b..070e37b5c 100644 --- a/Examples/xService_ChangeServiceStateConfig.ps1 +++ b/Examples/xService_ChangeServiceStateConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 7e8e91ba-ab33-4d7a-8b17-6fca60ccd040 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xService_CreateServiceConfig.ps1 b/Examples/xService_CreateServiceConfig.ps1 index edaca28b4..b1c38b4df 100644 --- a/Examples/xService_CreateServiceConfig.ps1 +++ b/Examples/xService_CreateServiceConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 22b2e2d1-76cd-4f4c-b952-ec3b574b9751 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xService_RemoveServiceConfig.ps1 b/Examples/xService_RemoveServiceConfig.ps1 index 631eeaae3..1279cc9b2 100644 --- a/Examples/xService_RemoveServiceConfig.ps1 +++ b/Examples/xService_RemoveServiceConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 6e48f4f6-5b67-4868-ba72-9732dc40ee98 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xService_UpdateStartupTypeIgnoreStateConfig.ps1 b/Examples/xService_UpdateStartupTypeIgnoreStateConfig.ps1 index fb4fd9441..563a9b1b9 100644 --- a/Examples/xService_UpdateStartupTypeIgnoreStateConfig.ps1 +++ b/Examples/xService_UpdateStartupTypeIgnoreStateConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 5a442bad-d301-463e-9510-79193ff1bf88 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xUser_CreateUserConfig.ps1 b/Examples/xUser_CreateUserConfig.ps1 index 5ea233335..d585e7748 100644 --- a/Examples/xUser_CreateUserConfig.ps1 +++ b/Examples/xUser_CreateUserConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID e694ded5-b732-4537-9df2-456f2374264e .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xUser_CreateUserDetailedConfig.ps1 b/Examples/xUser_CreateUserDetailedConfig.ps1 index da8a2184a..fae63ce98 100644 --- a/Examples/xUser_CreateUserDetailedConfig.ps1 +++ b/Examples/xUser_CreateUserDetailedConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 3353a4c7-e6b0-4ca9-852d-86d0c4a3e9a5 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xUser_RemoveUserConfig.ps1 b/Examples/xUser_RemoveUserConfig.ps1 index b53b3f061..edf5e908f 100644 --- a/Examples/xUser_RemoveUserConfig.ps1 +++ b/Examples/xUser_RemoveUserConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 87c4e4fa-7519-4838-b187-b6a2ff8d1a45 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xWindowsFeatureSet_AddFeaturesConfig.ps1 b/Examples/xWindowsFeatureSet_AddFeaturesConfig.ps1 index b0aee11b3..1b3da95e6 100644 --- a/Examples/xWindowsFeatureSet_AddFeaturesConfig.ps1 +++ b/Examples/xWindowsFeatureSet_AddFeaturesConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 923d8088-f7c0-4762-a958-197e3ffe8cf3 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xWindowsFeatureSet_RemoveFeaturesConfig.ps1 b/Examples/xWindowsFeatureSet_RemoveFeaturesConfig.ps1 index 6a1667a28..772417871 100644 --- a/Examples/xWindowsFeatureSet_RemoveFeaturesConfig.ps1 +++ b/Examples/xWindowsFeatureSet_RemoveFeaturesConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID a9adfe2f-d3cd-42ee-bc69-412adedd2745 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xWindowsFeature_AddFeatureConfig.ps1 b/Examples/xWindowsFeature_AddFeatureConfig.ps1 index 7322647bf..612d273fd 100644 --- a/Examples/xWindowsFeature_AddFeatureConfig.ps1 +++ b/Examples/xWindowsFeature_AddFeatureConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 2becfdf4-6679-47bb-9755-7ed2075607d6 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xWindowsFeature_AddFeatureUsingCredentialConfig.ps1 b/Examples/xWindowsFeature_AddFeatureUsingCredentialConfig.ps1 index 0dc0eb2e2..f34aca691 100644 --- a/Examples/xWindowsFeature_AddFeatureUsingCredentialConfig.ps1 +++ b/Examples/xWindowsFeature_AddFeatureUsingCredentialConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 725562ba-fa61-4976-be99-0cf3f04ffc6e .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xWindowsFeature_AddFeatureWithLogPathConfig.ps1 b/Examples/xWindowsFeature_AddFeatureWithLogPathConfig.ps1 index b9f83c62c..7929ffc47 100644 --- a/Examples/xWindowsFeature_AddFeatureWithLogPathConfig.ps1 +++ b/Examples/xWindowsFeature_AddFeatureWithLogPathConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID ea0e3b37-9a9e-4331-8dc6-f95ff353b3d4 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xWindowsFeature_RemoveFeatureConfig.ps1 b/Examples/xWindowsFeature_RemoveFeatureConfig.ps1 index 477c2e82b..a05e0ce6a 100644 --- a/Examples/xWindowsFeature_RemoveFeatureConfig.ps1 +++ b/Examples/xWindowsFeature_RemoveFeatureConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 281e1f4d-d196-4d0c-9444-bc40ec6ff9de .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xWindowsOptionalFeatureSet_DisableConfig.ps1 b/Examples/xWindowsOptionalFeatureSet_DisableConfig.ps1 index 1ecceea70..17f1e3cdd 100644 --- a/Examples/xWindowsOptionalFeatureSet_DisableConfig.ps1 +++ b/Examples/xWindowsOptionalFeatureSet_DisableConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 0deebd0b-2e1a-4b4f-a5e7-d8264754fa51 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xWindowsOptionalFeatureSet_EnableConfig.ps1 b/Examples/xWindowsOptionalFeatureSet_EnableConfig.ps1 index beb980768..b573715a9 100644 --- a/Examples/xWindowsOptionalFeatureSet_EnableConfig.ps1 +++ b/Examples/xWindowsOptionalFeatureSet_EnableConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID a2793140-4351-4310-8062-edb2af9f4429 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xWindowsOptionalFeature_DisableConfig.ps1 b/Examples/xWindowsOptionalFeature_DisableConfig.ps1 index 88d722366..8f6d50a04 100644 --- a/Examples/xWindowsOptionalFeature_DisableConfig.ps1 +++ b/Examples/xWindowsOptionalFeature_DisableConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 4671e4f7-7ba5-4736-8a29-d439db3d9bb7 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xWindowsOptionalFeature_EnableConfig.ps1 b/Examples/xWindowsOptionalFeature_EnableConfig.ps1 index 78537b461..4e8be13b5 100644 --- a/Examples/xWindowsOptionalFeature_EnableConfig.ps1 +++ b/Examples/xWindowsOptionalFeature_EnableConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 6fca965e-e3a2-4108-8385-d14bf2c4f0dc .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xWindowsPackageCab_InstallPackageConfig.ps1 b/Examples/xWindowsPackageCab_InstallPackageConfig.ps1 index 484117225..4486442bf 100644 --- a/Examples/xWindowsPackageCab_InstallPackageConfig.ps1 +++ b/Examples/xWindowsPackageCab_InstallPackageConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 6f363fbb-2d4b-4f39-8cfb-4dbff4bd04f6 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xWindowsProcess_StartProcessConfig.ps1 b/Examples/xWindowsProcess_StartProcessConfig.ps1 index e52962fe6..7a3af0a4c 100644 --- a/Examples/xWindowsProcess_StartProcessConfig.ps1 +++ b/Examples/xWindowsProcess_StartProcessConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 675c8d2d-f3b8-4715-a831-92591becd725 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xWindowsProcess_StartProcessUnderUserConfig.ps1 b/Examples/xWindowsProcess_StartProcessUnderUserConfig.ps1 index 97bf138f2..1ae552c9d 100644 --- a/Examples/xWindowsProcess_StartProcessUnderUserConfig.ps1 +++ b/Examples/xWindowsProcess_StartProcessUnderUserConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 1bea33c0-38a6-4332-82b9-e1a1d40b56dc .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xWindowsProcess_StopProcessConfig.ps1 b/Examples/xWindowsProcess_StopProcessConfig.ps1 index 783f04a06..6930e24bf 100644 --- a/Examples/xWindowsProcess_StopProcessConfig.ps1 +++ b/Examples/xWindowsProcess_StopProcessConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 6ee000de-f0c1-4aca-8423-33d35d3288e1 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. diff --git a/Examples/xWindowsProcess_StopProcessUnderUserConfig.ps1 b/Examples/xWindowsProcess_StopProcessUnderUserConfig.ps1 index 1e3d13455..ee0835116 100644 --- a/Examples/xWindowsProcess_StopProcessUnderUserConfig.ps1 +++ b/Examples/xWindowsProcess_StopProcessUnderUserConfig.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.0 +.VERSION 1.0.1 .GUID 73eb39e7-fdc0-4dae-af0e-0c1458d3c8c8 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation @@ -8,7 +8,7 @@ .LICENSEURI https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/xPSDesiredStateConfiguration .ICONURI -.EXTERNALMODULEDEPENDENCIES xPSDesiredStateConfiguration +.EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. From 1c131fe49de672b4a4d25c92c00584e1ff937284 Mon Sep 17 00:00:00 2001 From: Katie Keim Date: Wed, 25 Jul 2018 09:38:09 -0700 Subject: [PATCH 8/9] Releasing version 8.4.0.0 --- README.md | 2 + xPSDesiredStateConfiguration.psd1 | 89 +++++++++++++++++++++++++++---- 2 files changed, 80 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index a88648e13..a0205b84d 100644 --- a/README.md +++ b/README.md @@ -713,6 +713,8 @@ Publishes a 'FileInfo' object(s) to the pullserver configuration repository. It ### Unreleased +### 8.4.0.0 + * Changes to xPSDesiredStateConfiguration * Opt-in for the common tests validate module files and script files. * All files change to encoding UTF-8 (without byte order mark). diff --git a/xPSDesiredStateConfiguration.psd1 b/xPSDesiredStateConfiguration.psd1 index 25d44ca65..fee85a46f 100644 --- a/xPSDesiredStateConfiguration.psd1 +++ b/xPSDesiredStateConfiguration.psd1 @@ -1,6 +1,6 @@ @{ # Version number of this module. -moduleVersion = '8.3.0.0' +moduleVersion = '8.4.0.0' # ID used to uniquely identify this module GUID = 'cc8dc021-fa5f-4f96-8ecf-dfd68a6d9d48' @@ -53,17 +53,83 @@ PrivateData = @{ # ReleaseNotes of this module ReleaseNotes = '* Changes to xPSDesiredStateConfiguration - * README.md: Fixed typo. [Steve Banik (@stevebanik-ndsc)](https://github.com/stevebanik-ndsc) - * Adding a Branches section to the README.md with Codecov badges for both - master and dev branch ([issue 416](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/416)). + * Opt-in for the common tests validate module files and script files. + * All files change to encoding UTF-8 (without byte order mark). + * Opt-in for the common test for example validation. + * Added Visual Studio Code workspace settings that helps with formatting + against the style guideline. + * Update all examples for them to be able pass the common test validation. +* xEnvironment path documentation update demonstrating usage with multiple values ([issue 415](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/415). [Alex Kokkinos (@alexkokkinos)](https://github.com/alexkokkinos) * Changes to xWindowsProcess - * Integration tests for this resource should no longer fail randomly. A timing - issue made the tests fail in certain scenarios ([issue 420](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/420)). -* Changes to xDSCWebService - * Added the option to use a certificate based on it"s subject and template name instead of it"s thumbprint. Resolves [issue 205](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/205). - * xDSCWebService: Fixed an issue where Test-WebConfigModulesSetting would return $true when web.config contains a module and the desired state was for it to be absent. Resolves [issue 418](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/418). -* Updated the main DSCPullServerSetup readme to read easier, then updates the PowerShell comment based help for each function to follow normal help standards. [James Pogran (@jpogran)](https://github.com/jpogran) -* xRemoteFile: Remove progress bar for file download. This resolves issues [165](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/165) and [383](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/383) [Claudio Spizzi (@claudiospizzi)](https://github.com/claudiospizzi) + * Increased the wait time in the integration tests since the tests + still failed randomly ([issue 420](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/420)). +* Renamed and updated examples to be able to publish them to PowerShell Gallery. + * Sample\_xScript.ps1 → xScript\_WatchFileContentConfig.ps1 + * Sample\_xService\_UpdateStartupTypeIgnoreState.ps1 → xService\_UpdateStartupTypeIgnoreStateConfig.ps1 + * Sample\_xWindowsProcess\_Start.ps1 → xWindowsProcess\_StartProcessConfig.ps1 + * Sample\_xWindowsProcess\_StartUnderUser.ps1 → xWindowsProcess\_StartProcessUnderUserConfig.ps1 + * Sample\_xWindowsProcess\_Stop.ps1 → xWindowsProcess\_StopProcessConfig.ps1 + * Sample\_xWindowsProcess\_StopUnderUser.ps1 → xWindowsProcess\_StopProcessUnderUserConfig.ps1 + * Sample\_xUser\_CreateUser.ps1.ps1 → xUser\_CreateUserConfig.ps1 + * Sample\_xUser\_Generic.ps1.ps1 → xUser\_CreateUserDetailedConfig.ps1 + * Sample\_xWindowsFeature.ps1 → xWindowsFeature\_AddFeatureConfig.ps1 + * Sample\_xWindowsFeatureSet\_Install.ps1 → xWindowsFeatureSet\_AddFeaturesConfig.ps1 + * Sample\_xWindowsFeatureSet\_Uninstall.ps1 → xWindowsFeatureSet\_RemoveFeaturesConfig.ps1 + * Sample\_xRegistryResource\_AddKey.ps1 → xRegistryResource\_AddKeyConfig.ps1 + * Sample\_xRegistryResource\_RemoveKey.ps1 → xRegistryResource\_RemoveKeyConfig.ps1 + * Sample\_xRegistryResource\_AddOrModifyValue.ps1 → xRegistryResource\_AddOrModifyValueConfig.ps1 + * Sample\_xRegistryResource\_RemoveValue.ps1 → xRegistryResource\_RemoveValueConfig.ps1 + * Sample\_xService\_CreateService.ps1 → xService\_CreateServiceConfig.ps1 + * Sample\_xService\_DeleteService.ps1 → xService\_RemoveServiceConfig.ps1 + * Sample\_xServiceSet\_StartServices.ps1 → xServiceSet\_StartServicesConfig.ps1 + * Sample\_xServiceSet\_BuiltInAccount → xServiceSet\_EnsureBuiltInAccountConfig.ps1 + * Sample\_xWindowsPackageCab → xWindowsPackageCab\_InstallPackageConfig + * Sample\_xWindowsOptionalFeature.ps1 → xWindowsOptionalFeature\_EnableConfig.ps1 + * Sample\_xWindowsOptionalFeatureSet\_Enable.ps1 → xWindowsOptionalFeatureSet\_EnableConfig.ps1 + * Sample\_xWindowsOptionalFeatureSet\_Disable.ps1 → xWindowsOptionalFeatureSet\_DisableConfig.ps1 + * Sample\_xRemoteFileUsingProxy.ps1 → xRemoteFile\_DownloadFileUsingProxyConfig.ps1 + * Sample\_xRemoteFile.ps1 → xRemoteFile\_DownloadFileConfig.ps1 + * Sample\_xProcessSet\_Start.ps1 → xProcessSet\_StartProcessConfig.ps1 + * Sample\_xProcessSet\_Stop.ps1 → xProcessSet\_StopProcessConfig.ps1 + * Sample\_xMsiPackage\_UninstallPackageFromHttps.ps1 → xMsiPackage\_UninstallPackageFromHttpsConfig.ps1 + * Sample\_xMsiPackage\_UninstallPackageFromFile.ps1 → xMsiPackage\_UninstallPackageFromFileConfig.ps1 + * Sample\_xMsiPackage\_InstallPackageFromFile → xMsiPackage\_InstallPackageConfig.ps1 + * Sample\_xGroup\_SetMembers.ps1 → xGroup\_SetMembersConfig.ps1 + * Sample\_xGroup\_RemoveMembers.ps1 → xGroup\_RemoveMembersConfig.ps1 + * Sample\_xGroupSet\_AddMembers.ps1 → xGroupSet\_AddMembersConfig.ps1 + * Sample\_xFileUpload.ps1 → xFileUpload\_UploadToSMBShareConfig.ps1 + * Sample\_xEnvironment\_CreateMultiplePathVariables.ps1 → xEnvironment\_AddMultiplePathsConfig.ps1 + * Sample\_xEnvironment\_RemovePathVariables.ps1 → xEnvironment\_RemoveMultiplePathsConfig.ps1 + * Sample\_xEnvironment\_CreateNonPathVariable.ps1 → xEnvironment\_CreateNonPathVariableConfig.ps1 + * Sample\_xEnvironment\_Remove.ps1 → xEnvironment\_RemoveVariableConfig.ps1 + * Sample\_xArchive\_ExpandArchiveChecksumAndForce.ps1 → xArchive\_ExpandArchiveChecksumAndForceConfig.ps1 + * Sample\_xArchive\_ExpandArchiveDefaultValidationAndForce.ps1 → xArchive\_ExpandArchiveDefaultValidationAndForceConfig.ps1 + * Sample\_xArchive\_ExpandArchiveNoValidation.ps1 → xArchive\_ExpandArchiveNoValidationConfig.ps1 + * Sample\_xArchive\_ExpandArchiveNoValidationCredential.ps1 → xArchive\_ExpandArchiveNoValidationCredentialConfig.ps1 + * Sample\_xArchive\_RemoveArchiveChecksum.ps1 → xArchive\_RemoveArchiveChecksumConfig.ps1 + * Sample\_xArchive\_RemoveArchiveNoValidation.ps1 → xArchive\_RemoveArchiveNoValidationConfig.ps1 + * Sample\_InstallExeCreds\_xPackage.ps1 → xPackage\_InstallExeUsingCredentialsConfig.ps1 + * Sample\_InstallExeCredsRegistry\_xPackage.ps1 → xPackage\_InstallExeUsingCredentialsAndRegistryConfig.ps1 + * Sample\_InstallMSI\_xPackage.ps1 → xPackage\_InstallMsiConfig.ps1 + * Sample\_InstallMSIProductId\_xPackage.ps1 → xPackage\_InstallMsiUsingProductIdConfig.ps1 +* New examples + * xUser\_RemoveUserConfig.ps1 + * xWindowsFeature\_AddFeatureUsingCredentialConfig.ps1 + * xWindowsFeature\_AddFeatureWithLogPathConfig.ps1 + * xWindowsFeature\_RemoveFeatureConfig.ps1 + * xService\_ChangeServiceStateConfig.ps1 + * xWindowsOptionalFeature\_DisableConfig.ps1 + * xPSEndpoint\_NewConfig.ps1 + * xPSEndpoint\_NewWithDefaultsConfig.ps1 + * xPSEndpoint\_RemoveConfig.ps1 + * xPSEndpoint\_NewCustomConfig.ps1 +* Removed examples + * Sample\_xPSSessionConfiguration.ps1 - This file was split up in several examples, + those starting with "xPSEndpoint*". + * Sample\_xMsiPackage\_InstallPackageFromHttp - This was added to the example + xMsiPackage\_InstallPackageConfig.ps1 so the example sows either URI scheme. + * Sample\_xEnvironment\_CreatePathVariable.ps1 - Same as the new example + xEnvironment\_AddMultiplePaths.ps1 ' @@ -90,3 +156,4 @@ PrivateData = @{ + From 1063b2ffc7c3f95a1a3464568e180461cf899217 Mon Sep 17 00:00:00 2001 From: Katie Keim Date: Wed, 25 Jul 2018 10:58:46 -0700 Subject: [PATCH 9/9] Replacing arrow chars in manifest --- xPSDesiredStateConfiguration.psd1 | 116 +++++++++++++----------------- 1 file changed, 48 insertions(+), 68 deletions(-) diff --git a/xPSDesiredStateConfiguration.psd1 b/xPSDesiredStateConfiguration.psd1 index fee85a46f..77de13f58 100644 --- a/xPSDesiredStateConfiguration.psd1 +++ b/xPSDesiredStateConfiguration.psd1 @@ -64,54 +64,54 @@ PrivateData = @{ * Increased the wait time in the integration tests since the tests still failed randomly ([issue 420](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/420)). * Renamed and updated examples to be able to publish them to PowerShell Gallery. - * Sample\_xScript.ps1 → xScript\_WatchFileContentConfig.ps1 - * Sample\_xService\_UpdateStartupTypeIgnoreState.ps1 → xService\_UpdateStartupTypeIgnoreStateConfig.ps1 - * Sample\_xWindowsProcess\_Start.ps1 → xWindowsProcess\_StartProcessConfig.ps1 - * Sample\_xWindowsProcess\_StartUnderUser.ps1 → xWindowsProcess\_StartProcessUnderUserConfig.ps1 - * Sample\_xWindowsProcess\_Stop.ps1 → xWindowsProcess\_StopProcessConfig.ps1 - * Sample\_xWindowsProcess\_StopUnderUser.ps1 → xWindowsProcess\_StopProcessUnderUserConfig.ps1 - * Sample\_xUser\_CreateUser.ps1.ps1 → xUser\_CreateUserConfig.ps1 - * Sample\_xUser\_Generic.ps1.ps1 → xUser\_CreateUserDetailedConfig.ps1 - * Sample\_xWindowsFeature.ps1 → xWindowsFeature\_AddFeatureConfig.ps1 - * Sample\_xWindowsFeatureSet\_Install.ps1 → xWindowsFeatureSet\_AddFeaturesConfig.ps1 - * Sample\_xWindowsFeatureSet\_Uninstall.ps1 → xWindowsFeatureSet\_RemoveFeaturesConfig.ps1 - * Sample\_xRegistryResource\_AddKey.ps1 → xRegistryResource\_AddKeyConfig.ps1 - * Sample\_xRegistryResource\_RemoveKey.ps1 → xRegistryResource\_RemoveKeyConfig.ps1 - * Sample\_xRegistryResource\_AddOrModifyValue.ps1 → xRegistryResource\_AddOrModifyValueConfig.ps1 - * Sample\_xRegistryResource\_RemoveValue.ps1 → xRegistryResource\_RemoveValueConfig.ps1 - * Sample\_xService\_CreateService.ps1 → xService\_CreateServiceConfig.ps1 - * Sample\_xService\_DeleteService.ps1 → xService\_RemoveServiceConfig.ps1 - * Sample\_xServiceSet\_StartServices.ps1 → xServiceSet\_StartServicesConfig.ps1 - * Sample\_xServiceSet\_BuiltInAccount → xServiceSet\_EnsureBuiltInAccountConfig.ps1 - * Sample\_xWindowsPackageCab → xWindowsPackageCab\_InstallPackageConfig - * Sample\_xWindowsOptionalFeature.ps1 → xWindowsOptionalFeature\_EnableConfig.ps1 - * Sample\_xWindowsOptionalFeatureSet\_Enable.ps1 → xWindowsOptionalFeatureSet\_EnableConfig.ps1 - * Sample\_xWindowsOptionalFeatureSet\_Disable.ps1 → xWindowsOptionalFeatureSet\_DisableConfig.ps1 - * Sample\_xRemoteFileUsingProxy.ps1 → xRemoteFile\_DownloadFileUsingProxyConfig.ps1 - * Sample\_xRemoteFile.ps1 → xRemoteFile\_DownloadFileConfig.ps1 - * Sample\_xProcessSet\_Start.ps1 → xProcessSet\_StartProcessConfig.ps1 - * Sample\_xProcessSet\_Stop.ps1 → xProcessSet\_StopProcessConfig.ps1 - * Sample\_xMsiPackage\_UninstallPackageFromHttps.ps1 → xMsiPackage\_UninstallPackageFromHttpsConfig.ps1 - * Sample\_xMsiPackage\_UninstallPackageFromFile.ps1 → xMsiPackage\_UninstallPackageFromFileConfig.ps1 - * Sample\_xMsiPackage\_InstallPackageFromFile → xMsiPackage\_InstallPackageConfig.ps1 - * Sample\_xGroup\_SetMembers.ps1 → xGroup\_SetMembersConfig.ps1 - * Sample\_xGroup\_RemoveMembers.ps1 → xGroup\_RemoveMembersConfig.ps1 - * Sample\_xGroupSet\_AddMembers.ps1 → xGroupSet\_AddMembersConfig.ps1 - * Sample\_xFileUpload.ps1 → xFileUpload\_UploadToSMBShareConfig.ps1 - * Sample\_xEnvironment\_CreateMultiplePathVariables.ps1 → xEnvironment\_AddMultiplePathsConfig.ps1 - * Sample\_xEnvironment\_RemovePathVariables.ps1 → xEnvironment\_RemoveMultiplePathsConfig.ps1 - * Sample\_xEnvironment\_CreateNonPathVariable.ps1 → xEnvironment\_CreateNonPathVariableConfig.ps1 - * Sample\_xEnvironment\_Remove.ps1 → xEnvironment\_RemoveVariableConfig.ps1 - * Sample\_xArchive\_ExpandArchiveChecksumAndForce.ps1 → xArchive\_ExpandArchiveChecksumAndForceConfig.ps1 - * Sample\_xArchive\_ExpandArchiveDefaultValidationAndForce.ps1 → xArchive\_ExpandArchiveDefaultValidationAndForceConfig.ps1 - * Sample\_xArchive\_ExpandArchiveNoValidation.ps1 → xArchive\_ExpandArchiveNoValidationConfig.ps1 - * Sample\_xArchive\_ExpandArchiveNoValidationCredential.ps1 → xArchive\_ExpandArchiveNoValidationCredentialConfig.ps1 - * Sample\_xArchive\_RemoveArchiveChecksum.ps1 → xArchive\_RemoveArchiveChecksumConfig.ps1 - * Sample\_xArchive\_RemoveArchiveNoValidation.ps1 → xArchive\_RemoveArchiveNoValidationConfig.ps1 - * Sample\_InstallExeCreds\_xPackage.ps1 → xPackage\_InstallExeUsingCredentialsConfig.ps1 - * Sample\_InstallExeCredsRegistry\_xPackage.ps1 → xPackage\_InstallExeUsingCredentialsAndRegistryConfig.ps1 - * Sample\_InstallMSI\_xPackage.ps1 → xPackage\_InstallMsiConfig.ps1 - * Sample\_InstallMSIProductId\_xPackage.ps1 → xPackage\_InstallMsiUsingProductIdConfig.ps1 + * Sample\_xScript.ps1 to xScript\_WatchFileContentConfig.ps1 + * Sample\_xService\_UpdateStartupTypeIgnoreState.ps1 to xService\_UpdateStartupTypeIgnoreStateConfig.ps1 + * Sample\_xWindowsProcess\_Start.ps1 to xWindowsProcess\_StartProcessConfig.ps1 + * Sample\_xWindowsProcess\_StartUnderUser.ps1 to xWindowsProcess\_StartProcessUnderUserConfig.ps1 + * Sample\_xWindowsProcess\_Stop.ps1 to xWindowsProcess\_StopProcessConfig.ps1 + * Sample\_xWindowsProcess\_StopUnderUser.ps1 to xWindowsProcess\_StopProcessUnderUserConfig.ps1 + * Sample\_xUser\_CreateUser.ps1.ps1 to xUser\_CreateUserConfig.ps1 + * Sample\_xUser\_Generic.ps1.ps1 to xUser\_CreateUserDetailedConfig.ps1 + * Sample\_xWindowsFeature.ps1 to xWindowsFeature\_AddFeatureConfig.ps1 + * Sample\_xWindowsFeatureSet\_Install.ps1 to xWindowsFeatureSet\_AddFeaturesConfig.ps1 + * Sample\_xWindowsFeatureSet\_Uninstall.ps1 to xWindowsFeatureSet\_RemoveFeaturesConfig.ps1 + * Sample\_xRegistryResource\_AddKey.ps1 to xRegistryResource\_AddKeyConfig.ps1 + * Sample\_xRegistryResource\_RemoveKey.ps1 to xRegistryResource\_RemoveKeyConfig.ps1 + * Sample\_xRegistryResource\_AddOrModifyValue.ps1 to xRegistryResource\_AddOrModifyValueConfig.ps1 + * Sample\_xRegistryResource\_RemoveValue.ps1 to xRegistryResource\_RemoveValueConfig.ps1 + * Sample\_xService\_CreateService.ps1 to xService\_CreateServiceConfig.ps1 + * Sample\_xService\_DeleteService.ps1 to xService\_RemoveServiceConfig.ps1 + * Sample\_xServiceSet\_StartServices.ps1 to xServiceSet\_StartServicesConfig.ps1 + * Sample\_xServiceSet\_BuiltInAccount to xServiceSet\_EnsureBuiltInAccountConfig.ps1 + * Sample\_xWindowsPackageCab to xWindowsPackageCab\_InstallPackageConfig + * Sample\_xWindowsOptionalFeature.ps1 to xWindowsOptionalFeature\_EnableConfig.ps1 + * Sample\_xWindowsOptionalFeatureSet\_Enable.ps1 to xWindowsOptionalFeatureSet\_EnableConfig.ps1 + * Sample\_xWindowsOptionalFeatureSet\_Disable.ps1 to xWindowsOptionalFeatureSet\_DisableConfig.ps1 + * Sample\_xRemoteFileUsingProxy.ps1 to xRemoteFile\_DownloadFileUsingProxyConfig.ps1 + * Sample\_xRemoteFile.ps1 to xRemoteFile\_DownloadFileConfig.ps1 + * Sample\_xProcessSet\_Start.ps1 to xProcessSet\_StartProcessConfig.ps1 + * Sample\_xProcessSet\_Stop.ps1 to xProcessSet\_StopProcessConfig.ps1 + * Sample\_xMsiPackage\_UninstallPackageFromHttps.ps1 to xMsiPackage\_UninstallPackageFromHttpsConfig.ps1 + * Sample\_xMsiPackage\_UninstallPackageFromFile.ps1 to xMsiPackage\_UninstallPackageFromFileConfig.ps1 + * Sample\_xMsiPackage\_InstallPackageFromFile to xMsiPackage\_InstallPackageConfig.ps1 + * Sample\_xGroup\_SetMembers.ps1 to xGroup\_SetMembersConfig.ps1 + * Sample\_xGroup\_RemoveMembers.ps1 to xGroup\_RemoveMembersConfig.ps1 + * Sample\_xGroupSet\_AddMembers.ps1 to xGroupSet\_AddMembersConfig.ps1 + * Sample\_xFileUpload.ps1 to xFileUpload\_UploadToSMBShareConfig.ps1 + * Sample\_xEnvironment\_CreateMultiplePathVariables.ps1 to xEnvironment\_AddMultiplePathsConfig.ps1 + * Sample\_xEnvironment\_RemovePathVariables.ps1 to xEnvironment\_RemoveMultiplePathsConfig.ps1 + * Sample\_xEnvironment\_CreateNonPathVariable.ps1 to xEnvironment\_CreateNonPathVariableConfig.ps1 + * Sample\_xEnvironment\_Remove.ps1 to xEnvironment\_RemoveVariableConfig.ps1 + * Sample\_xArchive\_ExpandArchiveChecksumAndForce.ps1 to xArchive\_ExpandArchiveChecksumAndForceConfig.ps1 + * Sample\_xArchive\_ExpandArchiveDefaultValidationAndForce.ps1 to xArchive\_ExpandArchiveDefaultValidationAndForceConfig.ps1 + * Sample\_xArchive\_ExpandArchiveNoValidation.ps1 to xArchive\_ExpandArchiveNoValidationConfig.ps1 + * Sample\_xArchive\_ExpandArchiveNoValidationCredential.ps1 to xArchive\_ExpandArchiveNoValidationCredentialConfig.ps1 + * Sample\_xArchive\_RemoveArchiveChecksum.ps1 to xArchive\_RemoveArchiveChecksumConfig.ps1 + * Sample\_xArchive\_RemoveArchiveNoValidation.ps1 to xArchive\_RemoveArchiveNoValidationConfig.ps1 + * Sample\_InstallExeCreds\_xPackage.ps1 to xPackage\_InstallExeUsingCredentialsConfig.ps1 + * Sample\_InstallExeCredsRegistry\_xPackage.ps1 to xPackage\_InstallExeUsingCredentialsAndRegistryConfig.ps1 + * Sample\_InstallMSI\_xPackage.ps1 to xPackage\_InstallMsiConfig.ps1 + * Sample\_InstallMSIProductId\_xPackage.ps1 to xPackage\_InstallMsiUsingProductIdConfig.ps1 * New examples * xUser\_RemoveUserConfig.ps1 * xWindowsFeature\_AddFeatureUsingCredentialConfig.ps1 @@ -137,23 +137,3 @@ PrivateData = @{ } # End of PrivateData hashtable } - - - - - - - - - - - - - - - - - - - -