├── .gitattributes ├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ ├── General.md │ ├── Problem_with_resource.yml │ ├── Resource_proposal.yml │ └── config.yml ├── PULL_REQUEST_TEMPLATE.md └── stale.yml ├── .gitignore ├── .markdownlint.json ├── .vscode ├── analyzersettings.psd1 ├── settings.json └── tasks.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── GitVersion.yml ├── LICENSE ├── README.md ├── RequiredModules.psd1 ├── Resolve-Dependency.ps1 ├── Resolve-Dependency.psd1 ├── SECURITY.md ├── appveyor.yml ├── azure-pipelines.yml ├── build.ps1 ├── build.yaml ├── codecov.yml ├── source ├── Classes │ ├── 001.CMReason.ps1 │ └── 020.PSResourceRepository.ps1 ├── ComputerManagementDsc.psd1 ├── ComputerManagementDsc.psm1 ├── DSCResources │ ├── DSC_Computer │ │ ├── DSC_Computer.psm1 │ │ ├── DSC_Computer.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ └── DSC_Computer.strings.psd1 │ ├── DSC_IEEnhancedSecurityConfiguration │ │ ├── DSC_IEEnhancedSecurityConfiguration.psm1 │ │ ├── DSC_IEEnhancedSecurityConfiguration.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ └── DSC_IEEnhancedSecurityConfiguration.strings.psd1 │ ├── DSC_OfflineDomainJoin │ │ ├── DSC_OfflineDomainJoin.psm1 │ │ ├── DSC_OfflineDomainJoin.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ └── DSC_OfflineDomainJoin.strings.psd1 │ ├── DSC_PendingReboot │ │ ├── DSC_PendingReboot.psm1 │ │ ├── DSC_PendingReboot.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ ├── DSC_PendingReboot.data.psd1 │ │ │ └── DSC_PendingReboot.strings.psd1 │ ├── DSC_PowerPlan │ │ ├── DSC_PowerPlan.psm1 │ │ ├── DSC_PowerPlan.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ ├── DSC_PowerPlan.schema.mfl │ │ │ └── DSC_PowerPlan.strings.psd1 │ ├── DSC_PowerShellExecutionPolicy │ │ ├── DSC_PowerShellExecutionPolicy.psm1 │ │ ├── DSC_PowerShellExecutionPolicy.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ └── DSC_PowerShellExecutionPolicy.strings.psd1 │ ├── DSC_RemoteDesktopAdmin │ │ ├── DSC_RemoteDesktopAdmin.psm1 │ │ ├── DSC_RemoteDesktopAdmin.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ └── DSC_RemoteDesktopAdmin.strings.psd1 │ ├── DSC_ScheduledTask │ │ ├── DSC_ScheduledTask.psm1 │ │ ├── DSC_ScheduledTask.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ └── DSC_ScheduledTask.strings.psd1 │ ├── DSC_SmbServerConfiguration │ │ ├── DSC_SmbServerConfiguration.data.psd1 │ │ ├── DSC_SmbServerConfiguration.psm1 │ │ ├── DSC_SmbServerConfiguration.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ ├── DSC_SmbServerConfiguration.schema.mfl │ │ │ └── DSC_SmbServerConfiguration.strings.psd1 │ ├── DSC_SmbShare │ │ ├── DSC_SmbShare.psm1 │ │ ├── DSC_SmbShare.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ ├── DSC_SmbShare.schema.mfl │ │ │ └── DSC_SmbShare.strings.psd1 │ ├── DSC_SystemLocale │ │ ├── DSC_SystemLocale.psm1 │ │ ├── DSC_SystemLocale.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ └── DSC_SystemLocale.strings.psd1 │ ├── DSC_SystemProtection │ │ ├── DSC_SystemProtection.psm1 │ │ ├── DSC_SystemProtection.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ └── DSC_SystemProtection.strings.psd1 │ ├── DSC_SystemRestorePoint │ │ ├── DSC_SystemRestorePoint.psm1 │ │ ├── DSC_SystemRestorePoint.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ └── DSC_SystemRestorePoint.strings.psd1 │ ├── DSC_TimeZone │ │ ├── DSC_TimeZone.psm1 │ │ ├── DSC_TimeZone.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ └── DSC_TimeZone.strings.psd1 │ ├── DSC_UserAccountControl │ │ ├── DSC_UserAccountControl.psm1 │ │ ├── DSC_UserAccountControl.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ └── DSC_UserAccountControl.strings.psd1 │ ├── DSC_VirtualMemory │ │ ├── DSC_VirtualMemory.psm1 │ │ ├── DSC_VirtualMemory.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ └── DSC_VirtualMemory.strings.psd1 │ ├── DSC_WindowsCapability │ │ ├── DSC_WindowsCapability.psm1 │ │ ├── DSC_WindowsCapability.schema.mof │ │ ├── README.md │ │ └── en-US │ │ │ └── DSC_WindowsCapability.strings.psd1 │ └── DSC_WindowsEventLog │ │ ├── DSC_WindowsEventLog.psm1 │ │ ├── DSC_WindowsEventLog.schema.mof │ │ ├── README.md │ │ └── en-US │ │ └── DSC_WindowsEventLog.strings.psd1 ├── Examples │ ├── README.md │ └── Resources │ │ ├── Computer │ │ ├── 1-Computer_RenameComputerAndSetWorkgroup_Config.ps1 │ │ ├── 2-Computer_JoinDomain_Config.ps1 │ │ ├── 3-Computer_RenameComputerInDomain_Config.ps1 │ │ ├── 4-Computer_RenameComputerInWorkgroup_Config.ps1 │ │ ├── 5-Computer_UnjoinDomainAndJoinWorkgroup_Config.ps1 │ │ ├── 6-Computer_SetComputerDescriptionInWorkgroup_Config.ps1 │ │ └── 7-Computer_JoinDomainSpecifyingDC_Config.ps1 │ │ ├── IEEnhancedSecurityConfiguration │ │ ├── 1-IEEnhancedSecurityConfiguration_DisableForAdministrators_Config.ps1 │ │ └── 2-IEEnhancedSecurityConfiguration_DisableForUsers_Config.ps1 │ │ ├── OfflineDomainJoin │ │ └── 1-OfflineDomainJoin_JoinDomainUsingODJBlob_Config.ps1 │ │ ├── PSResourceRepository │ │ ├── 1-Register_PSGallery_Present.ps1 │ │ ├── 2-Register_PSRepository_Present.ps1 │ │ └── 3-Repository_Absent.ps1 │ │ ├── PendingReboot │ │ ├── 1-PendingReboot_RebootAfterDomainJoin_Config.ps1 │ │ └── 2-PendingReboot_ConfigMgrReboot_Config.ps1 │ │ ├── PowerPlan │ │ └── 1-PowerPlan_SetPowerPlan_Config.ps1 │ │ ├── PowerShellExecutionPolicy │ │ ├── 1-PowerShellExecutionPolicy_SetPolicy_Config.ps1 │ │ └── 2-PowerShellExecutionPolicy_SetPolicyForMultipleScopes_Config.ps1 │ │ ├── RemoteDesktopAdmin │ │ └── 1-RemoteDesktopAdmin_SetSecureRemoteDesktopAdmin_Config.ps1 │ │ ├── ScheduledTask │ │ ├── 1-ScheduledTask_CreateScheduledTaskOnce_Config.ps1 │ │ ├── 10-ScheduledTask_RunPowerShellTaskOnceAsUserInteractiveOnly_Config.ps1 │ │ ├── 11-ScheduledTask_DisableABuiltInTask_Config.ps1 │ │ ├── 12-ScheduledTask_DeleteABuiltInTask_Config.ps1 │ │ ├── 13-ScheduledTask_CreateScheduledTasksOnEvent_Config.ps1 │ │ ├── 14-ScheduledTask_RunPowerShellTaskOnceAsGroupManagedServiceAccount_Config.ps1 │ │ ├── 15-ScheduledTask_CreateScheduledTaskOnceSynchronizeAcrossTimeZoneEnabled_Config.ps1 │ │ ├── 16-ScheduledTask_CreateScheduledTasksAsBuiltInServiceAccount_Config.ps1 │ │ ├── 17-ScheduledTask_CreateScheduledTasksOnIdle_Config.ps1 │ │ ├── 18-ScheduledTask_CreateScheduledTasksAtCreation_Config.ps1 │ │ ├── 19-ScheduledTask_CreateScheduledTasksOnSessionState_Config.ps1 │ │ ├── 2-ScheduledTask_CreateScheduledTaskDaily_Config.ps1 │ │ ├── 3-ScheduledTask_CreateScheduledTasksDailyIndefinitely_Config.ps1 │ │ ├── 4-ScheduledTask_CreateScheduledTasksWeekly_Config.ps1 │ │ ├── 5-ScheduledTask_CreateScheduledTasksAtLogon_Config.ps1 │ │ ├── 6-ScheduledTask_CreateScheduledTasksAtStartup_Config.ps1 │ │ ├── 7-ScheduledTask_RunPowerShellTaskEvery15Minutes_Config.ps1 │ │ ├── 8-ScheduledTask_RunPowerShellTaskEvery15MinutesIndefinitely_Config.ps1 │ │ └── 9-ScheduledTask_RunPowerShellTaskOnceAsUserWithHighestPriveleges_Config.ps1 │ │ ├── SmbServerConfiguration │ │ ├── 1-SmbServerConfiguration_AllProperties_Config.ps1 │ │ └── 1-SmbServerConfiguration_DisableSmb1_Config.ps1 │ │ ├── SmbShare │ │ ├── 1-SmbShare_CreateShare_Config.ps1 │ │ ├── 2-SmbShare_CreateShareAllProperties_Config.ps1 │ │ ├── 3-SmbShare_RemoveShare_Config.ps1 │ │ └── 4-SmbShare_RecreateShare_Config.ps1 │ │ ├── SystemLocale │ │ └── 1-SystemLocale_SetSystemLocale_Config.ps1 │ │ ├── SystemProtection │ │ ├── 1-SystemProtection_EnableDriveC_Config.ps1 │ │ ├── 2-SystemProtection_EnableDriveC_5Percent_Config.ps1 │ │ ├── 3-SystemProtection_DisableDriveF_Config.ps1 │ │ ├── 4-SystemProtection_ReduceDriveCDiskUsage_Config.ps1 │ │ └── 5-SystemProtection_MultiDrive_Config.ps1 │ │ ├── SystemRestorePoint │ │ ├── 1-SystemRestorePoint_CreateModifySettings_Config.ps1 │ │ └── 2-SystemRestorePoint_DeleteApplicationInstalls_Config.ps1 │ │ ├── TimeZone │ │ └── 1-TimeZone_SetTimeZone_Config.ps1 │ │ ├── UserAccountControl │ │ ├── 1-UserAccountControl_ChangeNotificationLevel_Config.ps1 │ │ └── 2-UserAccountControl_GranularSettings_Config.ps1 │ │ ├── VirtualMemory │ │ └── 1-VirtualMemory_SetVirtualMemory_Config.ps1 │ │ ├── WindowsCapability │ │ ├── 1-WindowsCapability_AddWindowsCapability_Config.ps1 │ │ ├── 2-WindowsCapability_RemoveWindowsCapability_Config.ps1 │ │ ├── 3-WindowsCapability_AddWindowsCapabilitywithLogLevelandLogPath_Config.ps1 │ │ └── 4-WindowsCapability_AddWindowsCapabilitywithLogLevelLogPathandSource_Config.ps1 │ │ └── WindowsEventlog │ │ ├── 1-WindowsEventLog_SetLogSize_Config.ps1 │ │ ├── 10-WindowsEventLog_RegisterEventSourceWithAllFiles_Config.ps1 │ │ ├── 2-WindowsEventLog_SetLogMode_Config.ps1 │ │ ├── 3-WindowsEventlog_EnableWindowsEventLog_Config.ps1 │ │ ├── 4-WindowsEventLog_DisableWindowsEventLog_Config.ps1 │ │ ├── 5-WindowsEventLog_SetSecurityDescriptor_Config.ps1 │ │ ├── 6-WindowsEventLog_RestrictGuestAccess_Config.ps1 │ │ ├── 7-WindowsEventLog_AllowGuestAccess_Config.ps1 │ │ ├── 8-WindowsEventLog_RegisterEventSource_Config.ps1 │ │ └── 9-WindowsEventLog_RegisterEventSourceWithMessageFile_Config.ps1 ├── Modules │ └── ComputerManagementDsc.Common │ │ ├── ComputerManagementDsc.Common.psm1 │ │ ├── SetTimeZone.cs │ │ └── en-US │ │ └── ComputerManagementDsc.Common.strings.psd1 ├── WikiSource │ └── Home.md ├── en-US │ ├── ComputerManagementDsc.strings.psd1 │ ├── PSResourceRepository.strings.psd1 │ └── about_ComputerManagementDsc.help.txt └── prefix.ps1 └── tests ├── Integration ├── Classes │ ├── PSResourceRepository.config.ps1 │ └── PSResourceRepository.integration.tests.ps1 ├── ComputerManagementDsc.Common.Tests.ps1 ├── DSC_IEEnhancedSecurityConfiguration.Config.ps1 ├── DSC_IEEnhancedSecurityConfiguration.Integration.Tests.ps1 ├── DSC_PendingReboot.Tests.ps1 ├── DSC_PendingReboot.config.ps1 ├── DSC_PowerShellExecutionPolicy.Integration.Tests.ps1 ├── DSC_PowerShellExecutionPolicy.config.ps1 ├── DSC_RemoteDesktopAdmin.Integration.Tests.ps1 ├── DSC_RemoteDesktopAdmin.config.ps1 ├── DSC_ScheduledTask.Integration.Tests.ps1 ├── DSC_ScheduledTask.config.ps1 ├── DSC_SmbServerConfiguration.Tests.ps1 ├── DSC_SmbServerConfiguration.config.ps1 ├── DSC_SmbShare.Integration.Tests.ps1 ├── DSC_SmbShare.config.ps1 ├── DSC_SystemLocale.Integration.Tests.ps1 ├── DSC_SystemLocale.config.ps1 ├── DSC_TimeZone.Integration.Tests.ps1 ├── DSC_TimeZone.config.ps1 ├── DSC_UserAccountControl.Config.ps1 ├── DSC_UserAccountControl.Integration.Tests.ps1 ├── DSC_VirtualMemory.Integration.Tests.ps1 ├── DSC_VirtualMemory.config.ps1 ├── DSC_WindowsCapability.Integration.Tests.ps1 ├── DSC_WindowsCapability.config.ps1 ├── DSC_WindowsEventLog.Integration.Tests.ps1 └── DSC_WindowsEventLog.config.ps1 ├── TestHelpers └── CommonTestHelper.psm1 └── Unit ├── Classes ├── CMReason.Tests.ps1 └── PSResourceRepository.Tests.ps1 ├── ComputerManagementDsc.Common.Tests.ps1 ├── DSC_Computer.Tests.ps1 ├── DSC_IEEnhancedSecurityConfiguration.Tests.ps1 ├── DSC_OfflineDomainJoin.Tests.ps1 ├── DSC_PendingReboot.Tests.ps1 ├── DSC_PowerPlan.Tests.ps1 ├── DSC_PowerShellExecutionpolicy.Tests.ps1 ├── DSC_RemoteDesktopAdmin.Tests.ps1 ├── DSC_ScheduledTask.Tests.ps1 ├── DSC_SmbServerConfiguration.Tests.ps1 ├── DSC_SmbShare.Tests.ps1 ├── DSC_SystemLocale.Tests.ps1 ├── DSC_SystemProtection.Tests.ps1 ├── DSC_SystemRestorePoint.Tests.ps1 ├── DSC_TimeZone.Tests.ps1 ├── DSC_UserAccountControl.Tests.ps1 ├── DSC_VirtualMemory.Tests.ps1 ├── DSC_WindowsCapability.Tests.ps1 └── DSC_WindowsEventLog.Tests.ps1 /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text eol=crlf 5 | 6 | # Ensure any exe files are treated as binary 7 | *.exe binary 8 | *.jpg binary 9 | *.xl* binary 10 | *.pfx binary 11 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Please check out common DSC Community [contributing guidelines](https://dsccommunity.org/guidelines/contributing). 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/General.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: General question or documentation update 3 | about: If you have a general question or documentation update suggestion around the resource module. 4 | --- 5 | 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Problem_with_resource.yml: -------------------------------------------------------------------------------- 1 | name: Problem with a resource 2 | description: If you have a problem, bug, or enhancement with a resource in this resource module. 3 | labels: [] 4 | assignees: [] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Please prefix the issue title (above) with the resource name, e.g. 'ResourceName: Short description of my issue'! 10 | 11 | Your feedback and support is greatly appreciated, thanks for contributing! 12 | - type: textarea 13 | id: description 14 | attributes: 15 | label: Problem description 16 | description: Details of the scenario you tried and the problem that is occurring. 17 | validations: 18 | required: true 19 | - type: textarea 20 | id: logs 21 | attributes: 22 | label: Verbose logs 23 | description: | 24 | Verbose logs showing the problem. **NOTE! Sensitive information should be obfuscated.** _Will be automatically formatted as plain text._ 25 | placeholder: | 26 | Paste verbose logs here 27 | render: text 28 | validations: 29 | required: true 30 | - type: textarea 31 | id: configuration 32 | attributes: 33 | label: DSC configuration 34 | description: | 35 | The DSC configuration that is used to reproduce the issue (as detailed as possible). **NOTE! Sensitive information should be obfuscated.** _Will be automatically formatted as PowerShell code._ 36 | placeholder: | 37 | Paste DSC configuration here 38 | render: powershell 39 | validations: 40 | required: true 41 | - type: textarea 42 | id: suggestedSolution 43 | attributes: 44 | label: Suggested solution 45 | description: Do you have any suggestions how to solve the issue? 46 | validations: 47 | required: true 48 | - type: textarea 49 | id: targetNodeOS 50 | attributes: 51 | label: Operating system the target node is running 52 | description: | 53 | Please provide as much as possible about the target node, for example edition, version, build, and language. _Will be automatically formatted as plain text._ 54 | 55 | On OS with WMF 5.1 the following command can help get this information: `Get-ComputerInfo -Property @('OsName','OsOperatingSystemSKU','OSArchitecture','WindowsVersion','WindowsBuildLabEx','OsLanguage','OsMuiLanguages')` 56 | placeholder: | 57 | Add operating system information here 58 | render: text 59 | validations: 60 | required: true 61 | - type: textarea 62 | id: targetNodePS 63 | attributes: 64 | label: PowerShell version and build the target node is running 65 | description: | 66 | Please provide the version and build of PowerShell the target node is running. _Will be automatically formatted as plain text._ 67 | 68 | To help with this information, please run this command: `$PSVersionTable` 69 | placeholder: | 70 | Add PowerShell information here 71 | render: text 72 | validations: 73 | required: true 74 | - type: textarea 75 | id: moduleVersion 76 | attributes: 77 | label: ComputerManagementDsc version 78 | description: | 79 | Please provide the version of the ComputerManagementDsc module that was used. _Will be automatically formatted as plain text._ 80 | 81 | To help with this information, please run this command: `Get-Module -Name 'ComputerManagementDsc' -ListAvailable | ft Name,Version,Path` 82 | placeholder: | 83 | Add module information here 84 | render: text 85 | validations: 86 | required: true 87 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Resource_proposal.yml: -------------------------------------------------------------------------------- 1 | name: New resource proposal 2 | description: If you have a new resource proposal that you think should be added to this resource module. 3 | title: "NewResourceName: New resource proposal" 4 | labels: [] 5 | assignees: [] 6 | body: 7 | - type: markdown 8 | attributes: 9 | value: | 10 | Please replace `NewResourceName` in the issue title (above) with your proposed resource name. 11 | 12 | Thank you for contributing and making this resource module better! 13 | - type: textarea 14 | id: description 15 | attributes: 16 | label: Resource proposal 17 | description: Provide information how this resource will/should work and how it will help users. 18 | validations: 19 | required: true 20 | - type: textarea 21 | id: proposedProperties 22 | attributes: 23 | label: Proposed properties 24 | description: | 25 | List all the proposed properties that the resource should have (key, required, write, and/or read). For each property provide a detailed description, the data type, if a default value should be used, and if the property is limited to a set of values. 26 | value: | 27 | Property | Type qualifier | Data type | Description | Default value | Allowed values 28 | --- | --- | --- | --- | --- | --- 29 | PropertyName | Key | String | Detailed description | None | None 30 | validations: 31 | required: true 32 | - type: textarea 33 | id: considerations 34 | attributes: 35 | label: Special considerations or limitations 36 | description: | 37 | Provide any considerations or limitations you can think of that a contributor should take in account when coding the proposed resource, and or what limitations a user will encounter or should consider when using the proposed resource. 38 | validations: 39 | required: true 40 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: "Virtual PowerShell User Group #DSC channel" 4 | url: https://dsccommunity.org/community/contact/ 5 | about: "To talk to the community and maintainers of DSC Community, please visit the #DSC channel." 6 | 7 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 14 | 15 | #### Pull Request (PR) description 16 | 17 | 23 | 24 | #### This Pull Request (PR) fixes the following issues 25 | 26 | 34 | 35 | #### Task list 36 | 37 | 45 | 46 | - [ ] Added an entry to the change log under the Unreleased section of the 47 | file CHANGELOG.md. Entry should say what was changed and how that 48 | affects users (if applicable), and reference the issue being resolved 49 | (if applicable). 50 | - [ ] Resource documentation added/updated in README.md. 51 | - [ ] Resource parameter descriptions added/updated in README.md, schema.mof 52 | and comment-based help. 53 | - [ ] Comment-based help added/updated. 54 | - [ ] Localization strings added/updated in all localization files as appropriate. 55 | - [ ] Examples appropriately added/updated. 56 | - [ ] Unit tests added/updated. See [DSC Community Testing Guidelines](https://dsccommunity.org/guidelines/testing-guidelines). 57 | - [ ] Integration tests added/updated (where possible). See [DSC Community Testing Guidelines](https://dsccommunity.org/guidelines/testing-guidelines). 58 | - [ ] New/changed code adheres to [DSC Community Style Guidelines](https://dsccommunity.org/styleguidelines). 59 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-stale - https://github.com/probot/stale 2 | 3 | limitPerRun: 30 4 | 5 | pulls: 6 | daysUntilStale: 14 7 | daysUntilClose: false 8 | exemptProjects: true 9 | exemptMilestones: true 10 | staleLabel: abandoned 11 | exemptLabels: 12 | - needs review 13 | - on hold 14 | - waiting for CLA pass 15 | 16 | markComment: > 17 | Labeling this pull request (PR) as abandoned since it has gone 14 days or more 18 | since the last update. An abandoned PR can be continued by another contributor. 19 | The abandoned label will be removed if work on this PR is taken up again. 20 | 21 | issues: 22 | daysUntilStale: 30 23 | daysUntilClose: 40 24 | exemptProjects: true 25 | exemptMilestones: true 26 | staleLabel: stale 27 | exemptLabels: 28 | - bug 29 | - enhancement 30 | - tests 31 | - documentation 32 | - resource proposal 33 | - on hold 34 | 35 | markComment: > 36 | This issue has been automatically marked as stale because 37 | it has not had activity from the community in the last 30 days. It will be 38 | closed if no further activity occurs within 10 days. If the issue is labelled 39 | with any of the work labels (e.g bug, enhancement, documentation, or tests) 40 | then the issue will not auto-close. 41 | 42 | closeComment: > 43 | This issue has been automatically closed because it is has not had activity 44 | from the community in the last 40 days. 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.suo 2 | *.user 3 | *.coverage 4 | .vs 5 | .vscode 6 | .psproj 7 | .sln 8 | markdownissues.txt 9 | output/ 10 | 11 | -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "default": true, 3 | "MD029": { 4 | "style": "one" 5 | }, 6 | "MD013": true, 7 | "MD024": true, 8 | "MD034": true, 9 | "no-hard-tabs": true 10 | } 11 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "powershell.codeFormatting.openBraceOnSameLine": false, 3 | "powershell.codeFormatting.newLineAfterOpenBrace": true, 4 | "powershell.codeFormatting.newLineAfterCloseBrace": true, 5 | "powershell.codeFormatting.whitespaceBeforeOpenBrace": true, 6 | "powershell.codeFormatting.whitespaceBeforeOpenParen": true, 7 | "powershell.codeFormatting.whitespaceAroundOperator": true, 8 | "powershell.codeFormatting.whitespaceAfterSeparator": true, 9 | "powershell.codeFormatting.ignoreOneLineBlock": false, 10 | "powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline", 11 | "powershell.codeFormatting.preset": "Custom", 12 | "powershell.codeFormatting.alignPropertyValuePairs": true, 13 | "powershell.codeFormatting.useConstantStrings": true, 14 | "powershell.developer.bundledModulesPath": "${cwd}/output/RequiredModules", 15 | "powershell.scriptAnalysis.settingsPath": "/.vscode/analyzersettings.psd1", 16 | "powershell.scriptAnalysis.enable": true, 17 | "files.trimTrailingWhitespace": true, 18 | "files.trimFinalNewlines": true, 19 | "files.insertFinalNewline": true, 20 | "files.associations": { 21 | "*.ps1xml": "xml" 22 | }, 23 | "cSpell.dictionaries": [ 24 | "powershell" 25 | ], 26 | "cSpell.words": [ 27 | "COMPANYNAME", 28 | "ICONURI", 29 | "LICENSEURI", 30 | "PROJECTURI", 31 | "RELEASENOTES", 32 | "buildhelpers", 33 | "endregion", 34 | "gitversion", 35 | "icontains", 36 | "keepachangelog", 37 | "notin", 38 | "pscmdlet", 39 | "steppable" 40 | ], 41 | "cSpell.ignorePaths": [ 42 | ".git" 43 | ], 44 | "[markdown]": { 45 | "files.trimTrailingWhitespace": true, 46 | "files.encoding": "utf8" 47 | }, 48 | "powershell.pester.useLegacyCodeLens": false, 49 | "pester.testFilePath": [ 50 | "[tT]ests/[qQ][aA]/*.[tT]ests.[pP][sS]1", 51 | "[tT]ests/[uU]nit/**/*.[tT]ests.[pP][sS]1", 52 | "[tT]ests/[uU]nit/*.[tT]ests.[pP][sS]1" 53 | ], 54 | "pester.runTestsInNewProcess": true, 55 | "pester.pesterModulePath": "./output/RequiredModules/Pester", 56 | "powershell.pester.codeLens": true, 57 | "pester.suppressCodeLensNotice": true, 58 | "yaml.format.singleQuote": true, 59 | } 60 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | This project has adopted the [DSC Community Code of Conduct](https://dsccommunity.org/code_of_conduct). 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Please check out common DSC Community [contributing guidelines](https://dsccommunity.org/guidelines/contributing). 4 | 5 | ## Running the Tests 6 | 7 | If want to know how to run this module's tests you can look at the [Testing Guidelines](https://dsccommunity.org/guidelines/testing-guidelines/#running-tests) 8 | -------------------------------------------------------------------------------- /GitVersion.yml: -------------------------------------------------------------------------------- 1 | mode: ContinuousDelivery 2 | next-version: 4.1.0 3 | major-version-bump-message: '(breaking\schange|breaking)\b' 4 | minor-version-bump-message: '(adds?|minor)\b' 5 | patch-version-bump-message: '\s?(fix|patch)' 6 | no-bump-message: '\+semver:\s?(none|skip)' 7 | assembly-informational-format: '{NuGetVersionV2}+Sha.{Sha}.Date.{CommitDate}' 8 | branches: 9 | master: 10 | tag: preview 11 | regex: ^main$ 12 | pull-request: 13 | tag: PR 14 | feature: 15 | tag: useBranchName 16 | increment: Minor 17 | regex: f(eature(s)?)?[\/-] 18 | source-branches: ['master'] 19 | hotfix: 20 | tag: fix 21 | increment: Patch 22 | regex: (hot)?fix(es)?[\/-] 23 | source-branches: ['master'] 24 | 25 | ignore: 26 | sha: [] 27 | merge-message-formats: {} 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright the DSC Community contributors. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /RequiredModules.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | PSDependOptions = @{ 3 | AddToPath = $true 4 | Target = 'output\RequiredModules' 5 | Parameters = @{ 6 | Repository = '' 7 | } 8 | } 9 | 10 | InvokeBuild = 'latest' 11 | PSScriptAnalyzer = 'latest' 12 | Pester = 'latest' 13 | Plaster = 'latest' 14 | ModuleBuilder = 'latest' 15 | ChangelogManagement = 'latest' 16 | Sampler = 'latest' 17 | 'Sampler.GitHubTasks' = 'latest' 18 | MarkdownLinkCheck = 'latest' 19 | 'DscResource.Test' = 'latest' 20 | xDscResourceDesigner = 'latest' 21 | LoopbackAdapter = 'latest' 22 | 23 | # Build dependencies needed for using the module 24 | 'DscResource.Common' = 'latest' 25 | 'DscResource.Base' = 'latest' 26 | 27 | # Analyzer rules 28 | 'DscResource.AnalyzerRules' = 'latest' 29 | 'Indented.ScriptAnalyzerRules' = 'latest' 30 | 31 | # Prerequisite modules for documentation. 32 | 'DscResource.DocGenerator' = 'latest' 33 | PlatyPS = 'latest' 34 | } 35 | -------------------------------------------------------------------------------- /Resolve-Dependency.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | Gallery = 'PSGallery' 3 | AllowPrerelease = $false 4 | WithYAML = $true 5 | 6 | #UseModuleFast = $true 7 | #ModuleFastVersion = '0.1.2' 8 | #ModuleFastBleedingEdge = $true 9 | 10 | # Setting to $true currenly (2024-06-02) causes integration test failures 11 | UsePSResourceGet = $false 12 | #PSResourceGetVersion = '1.0.1' 13 | 14 | # Setting to $true currenly (2024-06-02) causes integration test failures 15 | UsePowerShellGetCompatibilityModule = $false 16 | UsePowerShellGetCompatibilityModuleVersion = '3.0.23-beta23' 17 | } 18 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | ## Security 2 | 3 | The DSC Community takes the security of our modules seriously, which includes all source code repositories managed through our GitHub organization. 4 | 5 | If you believe you have found a security vulnerability in any DSC Community owned repository, please report it to us as described below. 6 | 7 | ## Reporting Security Issues 8 | 9 | **Please do not report security vulnerabilities through public GitHub issues.** 10 | 11 | Instead, please report them to one or several members of the DSC Community organization. 12 | The easiest way to do so is to send us a direct message via twitter or slack. 13 | 14 | You should receive a response within 48 hours. If for some reason you do not, please follow up to other member of the community. 15 | 16 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 17 | 18 | * Type of issue 19 | * Full paths of source file(s) related to the manifestation of the issue 20 | * The location of the affected source code (tag/branch/commit or direct URL) 21 | * Any special configuration required to reproduce the issue 22 | * Step-by-step instructions to reproduce the issue 23 | * Proof-of-concept or exploit code (if possible) 24 | * Impact of the issue, including how an attacker might exploit the issue 25 | 26 | This information will help us triage your report more quickly. 27 | 28 | ## Preferred Languages 29 | 30 | We prefer all communications to be in English. 31 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # HOW TO DEBUG: See start of each build run's output how to connect with RDP to the build server for debugging. 2 | # See section on_finish last in this file on how to pause build and to keep RDP open. 3 | # Look for each "DEBUG:" comment below how to change 4 | 5 | version: 1.0.{build} 6 | 7 | # Do not build on full releases. 8 | skip_tags: true 9 | 10 | # See https://www.appveyor.com/docs/windows-images-software 11 | # DEBUG: for debug purpose, comment and un-comment images as needed. 12 | image: 13 | - Visual Studio 2019 # Windows Server 2019 14 | #- Visual Studio 2017 # Windows Server 2016 15 | #- Visual Studio 2013 # Windows Server 2012 R2 16 | 17 | environment: 18 | Dummy: AnyValue 19 | # DEBUG: Un-comment this to get the same password for the RDP session for each build 20 | #APPVEYOR_RDP_PASSWORD: D5c1234! 21 | 22 | # DEBUG: If running on own AppVeyor project, comment the if-block below to run on all branches. 23 | init: 24 | - ps: | 25 | # Only run for pull requests 26 | if (-not $env:APPVEYOR_PULL_REQUEST_NUMBER) { Write-Host -ForegroundColor 'Yellow' -Object 'Not a pull request, skipping.'; return } 27 | 28 | iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) 29 | 30 | # DEBUG: If running on own AppVeyor project, comment the if-block below to run on all branches. 31 | install: 32 | - ps: | 33 | # Only run for pull requests 34 | if (-not $env:APPVEYOR_PULL_REQUEST_NUMBER) { Write-Host -ForegroundColor 'Yellow' -Object 'Not a pull request, skipping.'; return } 35 | 36 | winrm quickconfig -quiet 37 | 38 | # DEBUG: If running on own AppVeyor project, comment the if-block below to run on all branches. 39 | build_script: 40 | - pwsh: | 41 | # Only run for pull requests 42 | if (-not $env:APPVEYOR_PULL_REQUEST_NUMBER) { Write-Host -ForegroundColor 'Yellow' -Object 'Not a pull request, skipping.'; return } 43 | 44 | # Set module version using GitVersion 45 | dotnet tool install --global GitVersion.Tool --version 5.* 46 | $env:IGNORE_NORMALISATION_GIT_HEAD_MOVE = 1 47 | dotnet-gitversion 48 | $gitVersionObject = dotnet-gitversion | ConvertFrom-Json 49 | $gitVersionObject 50 | $env:ModuleVersion = $gitVersionObject.NuGetVersionV2 51 | 52 | # Build the module 53 | ./build.ps1 -ResolveDependency -tasks build -UseModuleFast 54 | 55 | # DEBUG: If running on own AppVeyor project, comment the if-block below to run on all branches. 56 | test_script: 57 | - ps: | 58 | # Only run for pull requests 59 | if (-not $env:APPVEYOR_PULL_REQUEST_NUMBER) { Write-Host -ForegroundColor 'Yellow' -Object 'Not a pull request, skipping.'; return } 60 | 61 | ./build.ps1 -Tasks test -PesterScript 'tests/Integration' -CodeCoverageThreshold 0 62 | 63 | deploy: off 64 | 65 | # DEBUG: Un-comment the line "$blockRdp = $true" so that build worker is kept up all of the 60 minutes. 66 | # DEBUG: If running on own AppVeyor project, comment the if-block below to run on all branches. 67 | on_finish: 68 | - ps: | 69 | # Only run for pull requests 70 | if (-not $env:APPVEYOR_PULL_REQUEST_NUMBER) { Write-Host -ForegroundColor 'Yellow' -Object 'Not a pull request, skipping.'; return } 71 | 72 | <# 73 | These two lines can also be added in one or more places somewhere in the integration tests to pause the test run. Continue 74 | running the tests by deleting the file on the desktop that was created by "enable-rdp.ps1" when $blockRdp is $true. 75 | #> 76 | #$blockRdp = $true 77 | iex ((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) 78 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | require_ci_to_pass: no 3 | # main should be the baseline for reporting 4 | branch: main 5 | 6 | comment: 7 | layout: "reach, diff, flags, files" 8 | behavior: default 9 | 10 | coverage: 11 | range: 50..80 12 | round: down 13 | precision: 0 14 | 15 | status: 16 | project: 17 | default: 18 | # Set the overall project code coverage requirement to 70% 19 | target: 80 20 | patch: 21 | default: 22 | # Set the pull request requirement to not regress overall coverage by more than 5% 23 | # and let codecov.io set the goal for the code changed in the patch. 24 | target: auto 25 | threshold: 5 26 | 27 | # This is not needed if the module only contain class-based resources. 28 | fixes: 29 | - '^\d+\.\d+\.\d+::source' # move path "X.Y.Z" => "source" 30 | -------------------------------------------------------------------------------- /source/Classes/001.CMReason.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | The reason a property of a DSC resource is not in desired state. 4 | 5 | .DESCRIPTION 6 | A DSC resource can have a read-only property `Reasons` that the compliance 7 | part (audit via Azure Policy) of Azure AutoManage Machine Configuration 8 | uses. The property Reasons holds an array of CMReason. Each CMReason 9 | explains why a property of a DSC resource is not in desired state. 10 | #> 11 | 12 | class CMReason 13 | { 14 | [DscProperty()] 15 | [System.String] 16 | $Code 17 | 18 | [DscProperty()] 19 | [System.String] 20 | $Phrase 21 | } 22 | -------------------------------------------------------------------------------- /source/ComputerManagementDsc.psm1: -------------------------------------------------------------------------------- 1 | # Note: This content will get replaced as part of the module build. Do not add to this file. 2 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_Computer/DSC_Computer.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.1.0"), FriendlyName("Computer")] 2 | class DSC_Computer : OMI_BaseResource 3 | { 4 | [Key, Description("The desired computer name.")] String Name; 5 | [Write, Description("The name of the domain to join.")] String DomainName; 6 | [Write, Description("The distinguished name of the organizational unit that the computer account will be created in.")] String JoinOU; 7 | [Write, Description("Credential to be used to join a domain."), EmbeddedInstance("MSFT_Credential")] String Credential; 8 | [Write, Description("Credential to be used to leave a domain."), EmbeddedInstance("MSFT_Credential")] String UnjoinCredential; 9 | [Write, Description("The name of the workgroup.")] String WorkGroupName; 10 | [Write, Description("The value assigned here will be set as the local computer description.")] String Description; 11 | [Write, Description("The Active Directory Domain Controller to use to join the domain")] String Server; 12 | [Write, Description("Specifies advanced options for the Add-Computer join operation"), ValueMap{"AccountCreate","Win9XUpgrade","UnsecuredJoin","PasswordPass","JoinWithNewName","JoinReadOnly","InstallInvoke"}, Values{"AccountCreate","Win9XUpgrade","UnsecuredJoin","PasswordPass","JoinWithNewName","JoinReadOnly","InstallInvoke"}] String Options[]; 13 | [Read, Description("A read-only property that specifies the organizational unit that the computer account is currently in.")] String CurrentOU; 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_Computer/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | The resource allows you to configure a computer by changing its name and 4 | description and modifying its Active Directory domain or workgroup membership. 5 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_Computer/en-US/DSC_Computer.strings.psd1: -------------------------------------------------------------------------------- 1 | ConvertFrom-StringData @' 2 | GettingComputerStateMessage = Getting computer state for '{0}'. 3 | SettingComputerStateMessage = Setting computer state for '{0}'. 4 | SettingComputerDescriptionMessage = Setting computer description to '{0}'. 5 | RenamedComputerMessage = Renamed computer to '{0}'. 6 | RenamedComputerAndJoinedDomainMessage = Renamed computer to '{0}' and added to the domain '{1}'. 7 | JoinedDomainMessage = Added computer to domain '{0}'. 8 | FailToRenameAfterJoinDomainMessage = Failed to rename the computer during the domain join. Re-trying the rename. 9 | RenamedComputerAndJoinedWorkgroupMessage = Renamed computer to '{0}' and addded to workgroup '{1}'. 10 | JoinedWorkgroupMessage = Added computer to workgroup '{0}'. 11 | CredentialsNotSpecifiedError = Must to specify credentials with domain. 12 | TestingComputerStateMessage = Testing computer state for '{0}'. 13 | CheckingComputerDescriptionMessage = Checking if computer description is '{0}'. 14 | CheckingDomainMemberMessage = Checking if the machine is a member of domain '{0}'. 15 | CheckingNotDomainMemberMessage = Checking if the machine is a not a member of a domain. 16 | CheckingWorkgroupMemberMessage = Checking if the machine is a member of workgroup '{0}'. 17 | DomainNameAndWorkgroupNameError = Only DomainName or WorkGroupName can be specified at once. 18 | ComputerNotInDomainMessage = This machine is not a domain member. 19 | DeletedExistingComputerObject = Deleted existing computer object with name '{0}' at path '{1}'. 20 | InvalidOptionPasswordPassUnsecuredJoin = Domain Join option 'PasswordPass' may not be specified if 'UnsecuredJoin' is specified. 21 | InvalidOptionCredentialUnsecuredJoinNullUsername = 'Credential' username must be null if 'UnsecuredJoin' is specified. 22 | '@ 23 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_IEEnhancedSecurityConfiguration/DSC_IEEnhancedSecurityConfiguration.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.1.0"), FriendlyName("IEEnhancedSecurityConfiguration")] 2 | class DSC_IEEnhancedSecurityConfiguration : OMI_BaseResource 3 | { 4 | [Key, Description("Specifies the role for which the IE Enhanced Security Configuration should be changed."), ValueMap{"Administrators","Users"}, Values{"Administrators","Users"}] String Role; 5 | [Required, Description("Specifies if IE Enhanced Security Configuration should be enabled or disabled.")] Boolean Enabled; 6 | [Write, Description("Specifies if a restart of the node should be suppressed. By default the node will be restarted if the value is changed.")] Boolean SuppressRestart; 7 | }; 8 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_IEEnhancedSecurityConfiguration/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | This resource allows you to configure the IE Enhanced Security Configuration 4 | for administrator or user roles. 5 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_IEEnhancedSecurityConfiguration/en-US/DSC_IEEnhancedSecurityConfiguration.strings.psd1: -------------------------------------------------------------------------------- 1 | ConvertFrom-StringData @' 2 | GettingStateMessage = Getting IE Enhanced Security Configuration state for '{0}'. (IEESC0001) 3 | SettingStateMessage = Setting IE Enhanced Security Configuration state for '{0}'. (IEESC0002) 4 | TestingStateMessage = Testing IE Enhanced Security Configuration state for '{0}'. (IEESC0003) 5 | SuppressRestart = Suppressing the restart. For the change to come in affect the node must be restarted manually. (IEESC0004) 6 | InDesiredState = The IE Enhanced Security Configuration for '{0}' is in desired state. (IEESC0005) 7 | NotInDesiredState = The IE Enhanced Security Configuration for '{0}' was {1}, but expected it to be {2}. (IEESC0006) 8 | UnableToDetermineState = The current state cannot be determined because the registry path '{0}' cannot be read. (IEESC0007) 9 | FailedToSetDesiredState = Failed to set the desired state for '{0}'. (IEESC0008) 10 | '@ 11 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_OfflineDomainJoin/DSC_OfflineDomainJoin.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0.0"), FriendlyName("OfflineDomainJoin")] 2 | class DSC_OfflineDomainJoin : OMI_BaseResource 3 | { 4 | [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'."), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; 5 | [Required, Description("The full path to the Offline Domain Join Request file to use.")] String RequestFile; 6 | }; 7 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_OfflineDomainJoin/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | The resource allows you to join computers to an Active Directory domain using an 4 | [Offline Domain Join](https://technet.microsoft.com/en-us/library/offline-domain-join-djoin-step-by-step(v=ws.10).aspx) 5 | request file. 6 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_OfflineDomainJoin/en-US/DSC_OfflineDomainJoin.strings.psd1: -------------------------------------------------------------------------------- 1 | ConvertFrom-StringData @' 2 | GettingOfflineDomainJoinMessage = Getting the Offline Domain Join State. 3 | ApplyingOfflineDomainJoinMessage = Applying the Offline Domain Join State. 4 | AttemptingDomainJoinMessage = Attempting domain join using ODJ Request file '{0}'. 5 | DomainJoinedMessage = Domain joined using ODJ Request file '{0}'. Reboot will be required. 6 | CheckingOfflineDomainJoinMessage = Checking the Offline Domain Join State. 7 | DomainAlreadyJoinedMessage = The computer is already joined to a domain '{0}'. Change not required. 8 | DomainNotJoinedMessage = The computer is not joined to a domain. Change required. 9 | RequestFileNotFoundError = The ODJ Request file '{0}' does not exist. 10 | DjoinError = Error {0} occured requesting the Offline Domain Join. 11 | '@ 12 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_PendingReboot/DSC_PendingReboot.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0.0"), FriendlyName("PendingReboot")] 2 | class DSC_PendingReboot : OMI_BaseResource 3 | { 4 | [Key, Description("Specifies the name of this pending reboot check.")] String Name; 5 | [Write, Description("Specifies whether to skip reboots triggered by the Component-Based Servicing component.")] Boolean SkipComponentBasedServicing; 6 | [Read, Description("A value indicating whether the Component-Based Servicing component requested a reboot.")] Boolean ComponentBasedServicing; 7 | [Write, Description("Specifies whether to skip reboots triggered by Windows Update.")] Boolean SkipWindowsUpdate; 8 | [Read, Description("A value indicating whether Windows Update requested a reboot.")] Boolean WindowsUpdate; 9 | [Write, Description("Specifies whether to skip pending file rename reboots.")] Boolean SkipPendingFileRename; 10 | [Read, Description("A value indicating whether a pending file rename triggered a reboot.")] Boolean PendingFileRename; 11 | [Write, Description("Specifies whether to skip reboots triggered by a pending computer rename.")] Boolean SkipPendingComputerRename; 12 | [Read, Description("A value indicating whether a pending computer rename triggered a reboot.")] Boolean PendingComputerRename; 13 | [Write, Description("Specifies whether to skip reboots triggered by the ConfigMgr client. Defaults to True.")] Boolean SkipCcmClientSDK; 14 | [Read, Description("A value indicating whether the ConfigMgr client triggered a reboot.")] Boolean CcmClientSDK; 15 | [Read, Description("A value indicating whether the node requires a reboot.")] Boolean RebootRequired; 16 | }; 17 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_PendingReboot/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | PendingReboot examines three specific registry locations where a Windows Server 4 | might indicate that a reboot is pending and allows DSC to predictably handle 5 | the condition. 6 | 7 | DSC determines how to handle pending reboot conditions using the Local Configuration 8 | Manager (LCM) setting `RebootNodeIfNeeded`. When DSC resources require reboot, within 9 | a Set statement in a DSC Resource the global variable `DSCMachineStatus` is set to 10 | value '1'. When this condition occurs and RebootNodeIfNeeded is set to 'True', 11 | DSC reboots the machine after a successful Set. Otherwise, the reboot is postponed. 12 | 13 | Note: The expectation is that this resource will be used in conjunction with 14 | knowledge of DSC Local Configuration Manager, which has the ability to manage 15 | whether reboots happen automatically using the RebootIfNeeded parameter. For 16 | more information on configuring the LCM, please reference [this TechNet article](https://technet.microsoft.com/en-us/library/dn249922.aspx). 17 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_PendingReboot/en-US/DSC_PendingReboot.data.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | RebootTriggers = @( 3 | @{ 4 | Name = 'ComponentBasedServicing' 5 | Description = 'Component based servicing' 6 | }, 7 | @{ 8 | Name = 'WindowsUpdate' 9 | Description = 'Windows Update' 10 | }, 11 | @{ 12 | Name = 'PendingFileRename' 13 | Description = 'Pending file rename' 14 | }, 15 | @{ 16 | Name = 'PendingComputerRename' 17 | Description = 'Pending computer rename' 18 | }, 19 | @{ 20 | Name = 'CcmClientSDK' 21 | Description = 'ConfigMgr' 22 | } 23 | ) 24 | } 25 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_PendingReboot/en-US/DSC_PendingReboot.strings.psd1: -------------------------------------------------------------------------------- 1 | ConvertFrom-StringData @' 2 | GettingPendingRebootStateMessage = Getting the Pending Reboot State for '{0}'. (PR0001) 3 | TestingPendingRebootStateMessage = Testing the Pending Reboot State for '{0}'. (PR0002) 4 | RebootRequiredMessage = {0} reboot required. (PR0003) 5 | RebootNotRequiredMessage = {0} reboot is not required. (PR0004) 6 | RebootRequiredButSkippedMessage = {0} reboot required, but is skipped. (PR0005) 7 | SettingPendingRebootStateMessage = Setting the Pending Reboot State for '{0}' to reboot required. (PR0006) 8 | QueryCcmClientUtilitiesFailedMessage = Unable to query CIM Class CCM_ClientUtilities because '{0}'. (PR0007) 9 | '@ 10 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_PowerPlan/DSC_PowerPlan.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0.0"), FriendlyName("PowerPlan")] 2 | class DSC_PowerPlan : OMI_BaseResource 3 | { 4 | [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'."), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; 5 | [Required, Description("The name or GUID of the power plan to activate.")] String Name; 6 | [Read, Description("Determines if the power plan is active.")] Boolean IsActive; 7 | }; 8 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_PowerPlan/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | The resource allows specifying a power plan to activate. 4 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_PowerPlan/en-US/DSC_PowerPlan.schema.mfl: -------------------------------------------------------------------------------- 1 | [Description("This resource is used to activate a power plan.") : Amended,AMENDMENT, LOCALE("MS_409")] 2 | class DSC_PowerPlan : OMI_BaseResource 3 | { 4 | [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'.") : Amended] String IsSingleInstance; 5 | [Description("The name or GUID of the power plan to activate.") : Amended] String Name; 6 | }; 7 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_PowerPlan/en-US/DSC_PowerPlan.strings.psd1: -------------------------------------------------------------------------------- 1 | # Localized resources for WindowsOptionalFeature 2 | 3 | ConvertFrom-StringData @' 4 | PowerPlanIsActive = The power plan '{0}' is the active plan. 5 | PowerPlanIsNotActive = The power plan '{0}' is not the active plan. 6 | PowerPlanNotFound = Unable to find the power plan '{0}'. 7 | PowerPlanIsBeingActivated = Activating power plan '{0}'. 8 | PowerPlanIsBeingValidated = Validating power plan '{0}'. 9 | '@ 10 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_PowerShellExecutionPolicy/DSC_PowerShellExecutionPolicy.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0.0"), FriendlyName("PowerShellExecutionPolicy")] 2 | class DSC_PowerShellExecutionPolicy : OMI_BaseResource 3 | { 4 | [Key, Description("Defines the scope for the preference of the Windows PowerShell execution policy."), ValueMap{"CurrentUser","LocalMachine","MachinePolicy","Process","UserPolicy"},Values{"CurrentUser","LocalMachine","MachinePolicy","Process","UserPolicy"}] String ExecutionPolicyScope; 5 | [Required, Description("Changes the preference for the Windows PowerShell execution policy."), ValueMap{"Bypass","Restricted","AllSigned","RemoteSigned","Unrestricted"}, Values{"Bypass","Restricted","AllSigned","RemoteSigned","Unrestricted"}] String ExecutionPolicy; 6 | }; 7 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_PowerShellExecutionPolicy/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | This resource allows configuration of the PowerShell execution 4 | policy for different execution scopes. 5 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_PowerShellExecutionPolicy/en-US/DSC_PowerShellExecutionPolicy.strings.psd1: -------------------------------------------------------------------------------- 1 | # culture="en-US" 2 | ConvertFrom-StringData -StringData @' 3 | GettingPowerShellExecutionPolicy = The current execution policy for '{0}' is '{1}'. 4 | SettingPowerShellExecutionPolicy = Setting the execution policy for '{0}' to '{1}'. 5 | UpdatePowershellExecutionPolicySuccess = Updating PowerShell Execution policy for '{0}' to '{1}' successfully. 6 | UpdatePowershellExecutionPolicyFailed = Updating PowerShell Execution policy for '{0}' to '{1}' failed. 7 | TestingPowerShellExecutionPolicy = Testing the current execution policy for '{0}' is '{1}'. 8 | '@ 9 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_RemoteDesktopAdmin/DSC_RemoteDesktopAdmin.schema.mof: -------------------------------------------------------------------------------- 1 | 2 | [ClassVersion("1.0.0.0"), FriendlyName("RemoteDesktopAdmin")] 3 | class DSC_RemoteDesktopAdmin : OMI_BaseResource 4 | { 5 | [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; 6 | [Write, Description("Determines whether or not the computer should accept remote desktop connections. Present sets the value to Enabled and Absent sets the value to Disabled."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; 7 | [Write, Description("Setting this value to Secure configures the machine to require Network Level Authentication (NLA) for remote desktop connections."), ValueMap{"Secure","NonSecure"}, Values{"Secure","NonSecure"}] String UserAuthentication; 8 | }; 9 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_RemoteDesktopAdmin/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | This resource will manage the remote desktop administration settings on a computer. 4 | This includes whether remote desktop connections are allowed or denied and whether 5 | network level authentication is required. 6 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_RemoteDesktopAdmin/en-US/DSC_RemoteDesktopAdmin.strings.psd1: -------------------------------------------------------------------------------- 1 | # culture="en-US" 2 | ConvertFrom-StringData @' 3 | ParameterNeedsUpdateMessage = Remote Desktop Admin setting '{0}' is '{1}' but should be '{2}'. Change required. 4 | NotInDesiredStateMessage = Remote Desktop Admin is set to '{0}' but should be'{1}'. Change required. 5 | GettingRemoteDesktopAdminSettingsMessage = Getting Remote Desktop Admin settings. 6 | SettingRemoteDesktopAdminMessage = Setting Remote Desktop Admin to '{0}'. 7 | SettingUserAuthenticationMessage = Setting Remote Desktop Admin user authentication to '{0}'. 8 | '@ 9 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_ScheduledTask/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | The resource is used to define basic run once or recurring scheduled tasks 4 | on the local computer. It can also be used to delete or disable built-in 5 | scheduled tasks. 6 | 7 | ## Known Issues 8 | 9 | When creating a scheduled task with a StartTime, you should always specify both 10 | a date and a time, with the SortableDateTimePattern format (e.g. 1980-01-01T00:00:00). 11 | Not providing a date may result in 'flip flopping' if the remote server enters daylight 12 | savings time. The date and time specified will be set based on the time zone that has been 13 | configured on the device. If you want to synchronize a scheduled task across timezones, 14 | use the SynchronizeAcrossTimeZone parameter, and specify the timezone offset that is needed 15 | (e.g. 1980-01-01T00:00:00-08:00). 16 | 17 | One of the values needed for the `MultipleInstances` parameter is missing from the 18 | `Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum` 19 | enumerator. There are four valid values defined for the `MultipleInstances` property of the 20 | Task Settings ([TaskSettings.MultipleInstances Property](https://docs.microsoft.com/en-us/windows/win32/taskschd/tasksettings-multipleinstances "TaskSettings.MultipleInstances Property")). 21 | The `MultipleInstancesEnum` enumerator has three values, which can be mapped to three 22 | of the four valid values, but there is no value corresponding to `TASK_INSTANCES_STOP_EXISTING`. 23 | The result of this omission is that a workaround is required to 24 | accommodate the `StopExisting` value for the `MultipleInstances` parameter, 25 | which would not be necessary if the enumerator had all four valid values. 26 | 27 | ### ExecuteAsCredential 28 | 29 | #### When Using a BUILTIN Group 30 | 31 | When creating a scheduled task that uses an `ExecuteAsCredential` that 32 | is one of the 'BUILTIN' groups (e.g. 'BUILTIN\Users'), specifying the 33 | username to include the 'BUILTIN' domain name will result in the resource 34 | never going into state. The same behavior will also occur if setting a 35 | 'BUILTIN' group in the UI. 36 | 37 | To prevent this issue, set the username in the `ExecuteAsCredential` to the 38 | name of the group only (e.g. 'Users'). 39 | 40 | #### When Using a Domain User/Group 41 | 42 | When creating a scheduled task that uses an `ExecuteAsCredential` that 43 | is a domain user or group, (e.g. 'CONTOSO\ServiceUser'), the domain 44 | name must be included, otherwise the resource will not go into state. 45 | 46 | To prevent this issue, set the username in the `ExecuteAsCredential` to the 47 | name of the group only (e.g. 'CONTOSO\ServiceUser'). 48 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_SmbServerConfiguration/DSC_SmbServerConfiguration.data.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | smbServerSettings = @( 3 | 'AnnounceComment' 4 | 'AnnounceServer' 5 | 'AsynchronousCredits' 6 | 'AuditSmb1Access' 7 | 'AutoDisconnectTimeout' 8 | 'AutoShareServer' 9 | 'AutoShareWorkstation' 10 | 'CachedOpenLimit' 11 | 'DurableHandleV2TimeoutInSeconds' 12 | 'EnableAuthenticateUserSharing' 13 | 'EnableDownlevelTimewarp' 14 | 'EnableForcedLogoff' 15 | 'EnableLeasing' 16 | 'EnableMultiChannel' 17 | 'EnableOplocks' 18 | 'EnableSecuritySignature' 19 | 'EnableSMB1Protocol' 20 | 'EnableSMB2Protocol' 21 | 'EnableStrictNameChecking' 22 | 'EncryptData' 23 | 'IrpStackSize' 24 | 'KeepAliveTime' 25 | 'MaxChannelPerSession' 26 | 'MaxMpxCount' 27 | 'MaxSessionPerConnection' 28 | 'MaxThreadsPerQueue' 29 | 'MaxWorkItems' 30 | 'NullSessionPipes' 31 | 'NullSessionShares' 32 | 'OplockBreakWait' 33 | 'PendingClientTimeoutInSeconds' 34 | 'RejectUnencryptedAccess' 35 | 'RequireSecuritySignature' 36 | 'ServerHidden' 37 | 'Smb2CreditsMax' 38 | 'Smb2CreditsMin' 39 | 'SmbServerNameHardeningLevel' 40 | 'TreatHostAsStableStorage' 41 | 'ValidateAliasNotCircular' 42 | 'ValidateShareScope' 43 | 'ValidateShareScopeNotAliased' 44 | 'ValidateTargetName' 45 | ) 46 | } 47 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_SmbServerConfiguration/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | The resource is used to manage SMB Server Settings. 4 | 5 | ## Requirements 6 | 7 | Windows Server 2012 or newer. 8 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_SmbServerConfiguration/en-US/DSC_SmbServerConfiguration.strings.psd1: -------------------------------------------------------------------------------- 1 | # Localized resources for WindowsOptionalFeature 2 | 3 | ConvertFrom-StringData @' 4 | GetTargetResourceMessage = Getting the current state of the SMB Server. 5 | TestTargetResourceMessage = Determining if the SMB Server is in the desired state. 6 | EvaluatingProperties = Evaluating the '{0}' property of the SMB Server. Current value '{1}'. Requested value '{2}'. 7 | UpdatingProperties = Updating properties on the SMB Server. 8 | '@ 9 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_SmbShare/DSC_SmbShare.schema.mof: -------------------------------------------------------------------------------- 1 | 2 | [ClassVersion("1.0.0.0"), FriendlyName("SmbShare")] 3 | class DSC_SmbShare : OMI_BaseResource 4 | { 5 | [Key, Description("Specifies the name of the SMB share.")] String Name; 6 | [Required, Description("Specifies the path of the SMB share.")] String Path; 7 | [Write, Description("Specifies the description of the SMB share.")] String Description; 8 | [Write, Description("Specifies which accounts will be granted modify permission to access the SMB share.")] String ChangeAccess[]; 9 | [Write, Description("Specifies the maximum number of concurrently connected users that the new SMB share may accommodate. If this parameter is set to zero (0), then the number of users is unlimited. The default value is zero (0).")] Uint32 ConcurrentUserLimit; 10 | [Write, Description("Indicates that the SMB share is encrypted.")] Boolean EncryptData; 11 | [Write, Description("Specifies which files and folders in the new SMB share are visible to users."), ValueMap{"AccessBased","Unrestricted"}, Values{"AccessBased","Unrestricted"}] String FolderEnumerationMode; 12 | [Write, Description("Specifies the caching mode of the offline files for the SMB share."), ValueMap{"None","Manual","Programs","Documents","BranchCache"}, Values{"None","Manual","Programs","Documents","BranchCache"}] String CachingMode; 13 | [Write, Description("Specifies whether the SMB share should be continuously available.")] Boolean ContinuouslyAvailable; 14 | [Write, Description("Specifies which accounts are granted full permission to access the SMB share.")] String FullAccess[]; 15 | [Write, Description("Specifies which accounts are denied access to the SMB share.")] String NoAccess[]; 16 | [Write, Description("Specifies which accounts is granted read permission to access the SMB share.")] String ReadAccess[]; 17 | [Write, Description("Specifies if the SMB share should be added or removed."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; 18 | [Write, Description("Specifies if the SMB share is allowed to be dropped and recreated (required when the path changes).")] Boolean Force; 19 | [Write, Description("Specifies the scope in which the share should be created.")] String ScopeName; 20 | [Read, Description("Specifies the state of the SMB share.")] String ShareState; 21 | [Read, Description("Specifies the type of the SMB share.")] String ShareType; 22 | [Read, Description("Specifies if this SMB share is a ShadowCopy.")] Boolean ShadowCopy; 23 | [Read, Description("Specifies if this SMB share is a special share. E.g. an admin share, default shares, or IPC$ share.")] Boolean Special; 24 | }; 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_SmbShare/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | The resource is used to manage SMB shares, and access permissions to 4 | SMB shares. 5 | 6 | ## Requirements 7 | 8 | ### Cluster Shares 9 | 10 | The property `ContinuouslyAvailable` can only be set to `$true` when 11 | the SMB share is a cluster share in a failover cluster. Also in the blog 12 | [SMB Transparent Failover – making file shares continuously available](https://blogs.technet.microsoft.com/filecab/2016/03/25/smb-transparent-failover-making-file-shares-continuously-available-2) 13 | by [Claus Joergensen](https://github.com/clausjor) it is mentioned that 14 | SMB Transparent Failover does not support cluster disks with 8.3 name 15 | generation enabled. 16 | 17 | ### Access permissions 18 | 19 | It is not allowed to provide empty collections in the configuration for 20 | the access permissions parameters. The configuration below will cause an 21 | exception to be thrown. 22 | 23 | ```powershell 24 | SmbShare 'Integration_Test' 25 | { 26 | Name = 'TestShare' 27 | Path = 'C:\Temp' 28 | FullAccess = @() 29 | ChangeAccess = @() 30 | ReadAccess = @() 31 | NoAccess = @() 32 | } 33 | ``` 34 | 35 | The access permission parameters must either be all removed to manage 36 | the access permission manually, or add at least one member to one of 37 | the access permission parameters. If all the access permission parameters 38 | are removed, then by design, the cmdlet New-SmbShare will add 39 | the *Everyone* group with read access permission to the SMB share. 40 | To prevent that, add a member to either access permission parameters. 41 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_SmbShare/en-US/DSC_SmbShare.schema.mfl: -------------------------------------------------------------------------------- 1 | [Description("This resource is used to configure SMB shares.") : Amended,AMENDMENT, LOCALE("MS_409")] 2 | class DSC_SmbShare : OMI_BaseResource 3 | { 4 | [Key, Description("Specifies the name of the SMB share.") : Amended] String Name; 5 | [Description("Specifies the path of the SMB share.") : Amended] String Path; 6 | [Description("Specifies the description of the SMB share.") : Amended] String Description; 7 | [Description("Specifies which accounts will be granted modify permission to access the SMB share.") : Amended] String ChangeAccess[]; 8 | [Description("Specifies the maximum number of concurrently connected users that the new SMB share may accommodate. If this parameter is set to zero (0), then the number of users is unlimited. The default value is zero (0).") : Amended] Uint32 ConcurrentUserLimit; 9 | [Description("Indicates that the SMB share is encrypted.") : Amended] Boolean EncryptData; 10 | [Description("Specifies which files and folders in the new SMB share are visible to users.") : Amended] String FolderEnumerationMode; 11 | [Description("Specifies the caching mode of the offline files for the SMB share.") : Amended] String CachingMode; 12 | [Description("Specifies whether the SMB share should be continuously available.") : Amended] Boolean ContinuouslyAvailable; 13 | [Description("Specifies which accounts are granted full permission to access the SMB share.") : Amended] String FullAccess[]; 14 | [Description("Specifies which accounts are denied access to the SMB share.") : Amended] String NoAccess[]; 15 | [Description("Specifies which accounts is granted read permission to access the SMB share.") : Amended] String ReadAccess[]; 16 | [Description("Specifies if the SMB share should be added or removed.") : Amended] String Ensure; 17 | [Description("Specifies the state of the SMB share.") : Amended] String ShareState; 18 | [Description("Specifies the type of the SMB share.") : Amended] String ShareType; 19 | [Description("Specifies if this SMB share is a ShadowCopy.") : Amended] String ShadowCopy; 20 | [Description("Specifies if this SMB share is a special share. E.g. an admin share, default shares, or IPC$ share.") : Amended] String Special; 21 | }; 22 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_SmbShare/en-US/DSC_SmbShare.strings.psd1: -------------------------------------------------------------------------------- 1 | # Localized resources for WindowsOptionalFeature 2 | 3 | ConvertFrom-StringData @' 4 | GetTargetResourceMessage = Getting the current state of the SMB share '{0}'. 5 | TestTargetResourceMessage = Determining if the SMB share '{0}' is in the desired state. 6 | ShareNotFound = Unable to find a SMB share with the name '{0}'. 7 | IsPresent = The SMB share with the name '{0}' exist. 8 | IsAbsent = The SMB share with the name '{0}' does not exist. 9 | EvaluatingProperties = Evaluating the properties of the SMB share. 10 | UpdatingProperties = Updating properties on the SMB share that are not in desired state. 11 | RemoveShare = Removing the SMB share with the name '{0}'. 12 | CreateShare = Creating a SMB share with the name '{0}'. 13 | RecreateShare = Dropping and recreating share with name '{0}' 14 | RecreateShareError = Failed to recreate share with name '{0}'. The error was: '{1}'. 15 | NoRecreateShare = The share with name '{0}' exists on path {1}, desired state is on path {2}. Set Force = $true to allow drop and recreate of the share. 16 | RevokeAccess = Revoking granted permission for account '{0}' on the SMB share with the name '{1}'. 17 | UnblockAccess = Revoking denied permission for account '{0}' on the SMB share with the name '{1}'. 18 | GrantAccess = Granting '{0}' permission for account '{1}' on the SMB share with the name '{2}'. 19 | DenyAccess = Denying permission for account '{0}' on the SMB share with the name '{1}'. 20 | InvalidAccessParametersCombination = Not allowed to have all access permission parameters set to empty collections. Must either remove the access permission parameters completely, or add at least one member to one of the access permission parameters. 21 | '@ 22 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_SystemLocale/DSC_SystemLocale.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0.0"), FriendlyName("SystemLocale")] 2 | class DSC_SystemLocale : OMI_BaseResource 3 | { 4 | [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; 5 | [Required, Description("Specifies the System Locale.")] String SystemLocale; 6 | }; 7 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_SystemLocale/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | Ths resource is used set the system locale on a Windows machine. 4 | 5 | To get a list of valid Windows System Locales use the command: 6 | `[System.Globalization.CultureInfo]::GetCultures([System.Globalization.CultureTypes]::AllCultures).name` 7 | 8 | If the System Locale is changed by this resource, it will require the node 9 | to reboot. If the LCM is not configured to allow restarting, the configuration 10 | will not be able to be applied until a manual restart occurs. 11 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_SystemLocale/en-US/DSC_SystemLocale.strings.psd1: -------------------------------------------------------------------------------- 1 | # culture="en-US" 2 | ConvertFrom-StringData -StringData @' 3 | GettingSystemLocaleMessage = Getting Windows system locale. 4 | SettingSystemLocaleMessage = Setting Windows system locale. 5 | SystemLocaleUpdatedMessage = Windows system locale updated to "{0}". A system restart is required. 6 | TestingSystemLocaleMessage = Testing Windows system locale. 7 | SystemLocaleParameterNeedsUpdateMessage = Windows system locale is "{0}" but should be "{1}". Change required. 8 | InvalidSystemLocaleError = The Windows system locale "{0}" is invalid. 9 | '@ 10 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_SystemProtection/DSC_SystemProtection.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0.0"), FriendlyName("SystemProtection")] 2 | class DSC_SystemProtection : OMI_BaseResource 3 | { 4 | [Required, Description("Indicates that the computer restore is enabled or is disabled."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; 5 | [Key, Description("Specifies the drive letter to enable or disable protection on.")] String DriveLetter; 6 | [Write, Description("Specifies the maximum disk space to use for protection as a percentage.")] Sint32 DiskUsage; 7 | [Write, Description("Forces desired state to be applied regardless of data loss. Defaults to False.")] Boolean Force; 8 | }; 9 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_SystemProtection/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | This resource is used configure System Protection. System 4 | Protection is only applicable to workstation operating 5 | systems. Server operating systems are not supported. 6 | 7 | ## DiskUsage and Force Parameters 8 | 9 | The amount of disk that can be allocated for System Protection 10 | is configurable on a per-drive basis which is why this 11 | resource doesn't accept an array of drives like xWindowsRestore 12 | did. 13 | 14 | If you reduce the disk usage for a protected drive, the resource 15 | will try to resize it but VSS could throw an error because you 16 | have to delete checkpoints first. When you set Force to $true, 17 | SystemProtection will attempt the resize and if VSS throws an 18 | error, SystemProtection will delete **all** checkpoints on the 19 | the protected drive and try the resize operation again. 20 | 21 | Make sure you fully understand and accept the risks associated 22 | with using the Force parameter. 23 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_SystemProtection/en-US/DSC_SystemProtection.strings.psd1: -------------------------------------------------------------------------------- 1 | # Culture = "en-US" 2 | ConvertFrom-StringData -StringData @' 3 | NotWorkstationOS = This resource can only be used on workstation operating systems. (SP0001) 4 | FoundServerOS = It appears we are running on a server operating system (ProductType = {0}). (SP0002) 5 | FoundWorkstationOS = It appears we are running on a worksstation operating system (ProductType = {0}). (SP0003) 6 | ReturningTrueToBeSafe = The test will evaluate to True to prevent an unintentional set targeting a server operating system. (SP0004) 7 | SystemProtectionState = Overall system protection state is {0}. (SP0005) 8 | UnknownOperatingSystemError = The operating system threw an error trying to retrieve system protection settings. (SP0006) 9 | GetEnabledDrivesFailure = An error occurred trying to retrieve the list of drives where system protection is enabled. (SP0007) 10 | DriveFound = Drive {0} has system protection enabled with maximum disk usage of {1} percent. (SP0008) 11 | DriveSkipped = Skipping drive {0} because it is not the drive to find (SP0009) 12 | VssAdminReturnValues = {1} Operation: VSS returned exit code {0} (Force = {2}). (SP0010) 13 | InDesiredStateDriveLetter = Set inDesiredState to {0} based on drive letter evaluation. (SP0011) 14 | EnableComputerRestoreFailure = An unexpected error occurred trying to enable system protection on drive {0}. (SP0012) 15 | DisableComputerRestoreFailure = An unexpected error occurred trying to disable system protection on drive {0}. (SP0013) 16 | InDesiredStateDiskUsageFalse = Set inDesiredState to false because the current maximum disk usage for drive {0} is not in the desired state. (SP0014) 17 | InDesiredStateDiskUsageUnchanged = Not changing inDesiredState because the current maximum disk usage for drive {0} is in the desired state. (SP0015) 18 | EnableComputerRestoreSuccess = System protection for drive {0} has been enabled successfully. (SP0016) 19 | DisableComputerRestoreSuccess = System protection for drive {0} has been disabled successfully. (SP0017) 20 | VssShadowResizeSuccess = System protection disk usage was changed successfully. (SP0018) 21 | VssShadowResizeFailure = An unexpected error occurred trying to configure the maximum disk usage for drive {0}. (SP0019) 22 | VssShadowDeleteFailure = An unexpected error occurred tying to delete restore points for drive {0}. VSS corruption and/or orphaned shadow copies are the most likely reasons for the failure. (SP0020) 23 | VssShadowResizeFailureWithForce = Deleting restore points for drive {0} because the resize operation failed and the Force option was specified. (SP0021) 24 | VssShadowResizeFailureWithForce2 = An unexpected error occurred trying to configure the maximum disk usage for drive {0} even after deleting its restore points. VSS corruption and/or orphaned shadow copies are the most likely reasons for the failure. (SP0022) 25 | '@ 26 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_SystemRestorePoint/DSC_SystemRestorePoint.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0.0"), FriendlyName("SystemRestorePoint")] 2 | class DSC_SystemRestorePoint : OMI_BaseResource 3 | { 4 | [Required, Description("Indicates that the computer restore is enabled or is disabled."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; 5 | [Key, Description("Specifies a descriptive name for the restore point.")] String Description; 6 | [Write, Description("Specifies the restore point type. Defaults to APPLICATION_INSTALL."), ValueMap{"APPLICATION_INSTALL","APPLICATION_UNINSTALL","DEVICE_DRIVER_INSTALL","MODIFY_SETTINGS","CANCELLED_OPERATION"}, Values{"APPLICATION_INSTALL","APPLICATION_UNINSTALL","DEVICE_DRIVER_INSTALL","MODIFY_SETTINGS","CANCELLED_OPERATION"}] String RestorePointType; 7 | }; 8 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_SystemRestorePoint/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | This resource is used to create and delete restore points. 4 | System Protection must be enabled on at least one drive for 5 | this module to work. 6 | 7 | System restore points are only applicable to workstation 8 | operating systems. Server operating systems are not supported. 9 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_SystemRestorePoint/en-US/DSC_SystemRestorePoint.strings.psd1: -------------------------------------------------------------------------------- 1 | # Culture = "en-US" 2 | ConvertFrom-StringData -StringData @' 3 | NotWorkstationOS = This resource can only be used on workstation operating systems. (SR0001) 4 | ReturningTrueToBeSafe = The test will evaluate to True to prevent an unintentional set targeting a server operating system. (SP0002) 5 | NoRestorePointsFound = No checkpoints have been created on the computer. (SR0003) 6 | CreateRestorePoint = Creating restore point on the target computer. Description = [{0}]. (SR0004) 7 | NumRestorePoints = Found {0} restore points that match the parameters provided. (SR0005) 8 | CheckpointFailure = An error occurred trying to create the restore point. (SR0006) 9 | DeleteRestorePoint = Deleting restore point ({0}/{1}). (SR0007) 10 | DeleteCheckpointFailure = An error occurred trying to delete the restore point. (SR0008) 11 | RestorePointProperties = Retrieved restore point with Ensure = [{0}] and restore point type = [{1}]. (SR0009) 12 | '@ 13 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_TimeZone/DSC_TimeZone.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0.0"), FriendlyName("TimeZone")] 2 | class DSC_TimeZone : OMI_BaseResource 3 | { 4 | [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'."), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; 5 | [Required, Description("Specifies the TimeZone.")] String TimeZone; 6 | }; 7 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_TimeZone/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | The resource will use the `Get-TimeZone` cmdlet to get the current 4 | time zone. If `Get-TimeZone` is not available them CIM will be used to retrieve 5 | the current time zone. To update the time zone, .NET reflection will be used to 6 | update the time zone if required. If .NET reflection is not supported on the node 7 | (in the case of Nano Server) then tzutil.exe will be used to set the time zone. 8 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_TimeZone/en-US/DSC_TimeZone.strings.psd1: -------------------------------------------------------------------------------- 1 | # culture="en-US" 2 | ConvertFrom-StringData -StringData @' 3 | GettingTimeZoneMessage = Getting the time zone. 4 | SettingTimeZoneMessage = Setting the time zone. 5 | TimeZoneAlreadySetMessage = Time zone already set to {0}. 6 | TestingTimeZoneMessage = Testing the time zone. 7 | '@ 8 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_UserAccountControl/DSC_UserAccountControl.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0.0"), FriendlyName("UserAccountControl")] 2 | class DSC_UserAccountControl : OMI_BaseResource 3 | { 4 | [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'."), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; 5 | [Write, Description("Specifies the desired notification level for the User Account Control setting. This parameter can not be used at the same time as any of the granular parameters."), ValueMap{"AlwaysNotify", "AlwaysNotifyAndAskForCredentials", "NotifyChanges", "NotifyChangesWithoutDimming", "NeverNotify", "NeverNotifyAndDisableAll"}, Values{"AlwaysNotify", "AlwaysNotifyAndAskForCredentials", "NotifyChanges", "NotifyChangesWithoutDimming", "NeverNotify", "NeverNotifyAndDisableAll"}] String NotificationLevel; 6 | [Write, Description("Specifies the mode for the built-in administrator account (RID 500)."), ValueMap{"0", "1"}, Values{"0", "1"}] UInt16 FilterAdministratorToken; 7 | [Write, Description("Specifies the prompt behavior for the Consent Administrator."), ValueMap{"0", "1", "2", "3", "4", "5"}, Values{"0", "1", "2", "3", "4", "5"}] UInt16 ConsentPromptBehaviorAdmin; 8 | [Write, Description("Specifies how the operations that requires elevation is handled for users."), ValueMap{"0", "1", "3"}, Values{"0", "1", "3"}] UInt16 ConsentPromptBehaviorUser; 9 | [Write, Description("Specifies how package installations are handled."), ValueMap{"0", "1"}, Values{"0", "1"}] UInt16 EnableInstallerDetection; 10 | [Write, Description("Specifies how cryptographic signatures on interactive applications are handled."), ValueMap{"0", "1"}, Values{"0", "1"}] UInt16 ValidateAdminCodeSignatures; 11 | [Write, Description("Specifies how the 'administrator in Admin Approval Mode' user type are handled."), ValueMap{"0", "1"}, Values{"0", "1"}] UInt16 EnableLua; 12 | [Write, Description("Specifies if secure desktop prompting are used."), ValueMap{"0", "1"}, Values{"0", "1"}] UInt16 PromptOnSecureDesktop; 13 | [Write, Description("Specifies how redirection of legacy application File and Registry writes are handled."), ValueMap{"0", "1"}, Values{"0", "1"}] UInt16 EnableVirtualization; 14 | [Write, Description("Specifies if a restart of the node should be suppressed. By default the node will be restarted if the value is changed.")] Boolean SuppressRestart; 15 | }; 16 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_UserAccountControl/en-US/DSC_UserAccountControl.strings.psd1: -------------------------------------------------------------------------------- 1 | ConvertFrom-StringData @' 2 | GettingStateMessage = Getting the current notification level of the User Account Control. (UAC0001) 3 | SettingStateMessage = Setting User Account Control state. (UAC0002) 4 | TestingStateMessage = Testing User Account Control state. (UAC0003) 5 | SuppressRestart = Suppressing the restart. For the change to come in affect the node must be restarted manually. (UAC0004) 6 | NotificationLevelInDesiredState = The User Account Control notification level is in desired state. (UAC0005) 7 | NotificationLevelNoInDesiredState = The User Account Control notification level was '{0}', but expected it to be '{1}'. (UAC0006) 8 | GranularPropertiesInDesiredState = The User Account Control properties are in desired state. (UAC0007) 9 | GranularPropertyNoInDesiredState = The User Account Control property '{0}' was '{1}', but expected it to be '{2}'. (UAC0008) 10 | SetPropertyToValue = Setting the property '{0}' to the value '{1}'. (UAC0009) 11 | SetNotificationLevel = Setting the notification level to '{0}'. (UAC0010) 12 | FailedToSetNotificationLevel = Failed to set the notification level '{0}'. (UAC0011) 13 | FailedToSetGranularProperty = Failed to set the property '{0}'. (UAC0012) 14 | '@ 15 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_VirtualMemory/DSC_VirtualMemory.schema.mof: -------------------------------------------------------------------------------- 1 | 2 | [ClassVersion("1.0.0.0"), FriendlyName("VirtualMemory")] 3 | class DSC_VirtualMemory : OMI_BaseResource 4 | { 5 | [Key, Description("The drive letter for which paging settings should be set. Can be letter only, letter and colon or letter with colon and trailing slash.")] String Drive; 6 | [Key, Description("The type of the paging setting to use. If set to AutoManagePagingFile, the drive letter will be ignored. If set to SystemManagedSize, the values for InitialSize and MaximumSize will be ignored"), ValueMap{"AutoManagePagingFile","CustomSize","SystemManagedSize","NoPagingFile"}, Values{"AutoManagePagingFile","CustomSize","SystemManagedSize","NoPagingFile"}] String Type; 7 | [Write, Description("The initial size of the page file in Megabyte")] Sint64 InitialSize; 8 | [Write, Description("The maximum size of the page file in Megabyte")] Sint64 MaximumSize; 9 | }; 10 | 11 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_VirtualMemory/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | The resource allows configuration of properties of the paging file on 4 | the local computer. 5 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_VirtualMemory/en-US/DSC_VirtualMemory.strings.psd1: -------------------------------------------------------------------------------- 1 | ConvertFrom-StringData @' 2 | GettingVirtualMemoryMessage = Getting Virtual Memory. 3 | SettingVirtualMemoryMessage = Setting Virtual Memory. 4 | SetAutoManagePagingMessage = {0} automatically managed page file. 5 | GettingPageFileSettingsMessage = Getting page file settings for drive {0}. 6 | SettingPageFileSettingsMessage = Setting page file settings for drive {0} with initial size of {1}MB and maximum size {2}MB. 7 | NewPageFileMessage = Creating new page file '{0}'. 8 | RemovePageFileMessage = Removing existing page file '{0}'. 9 | DisabledPageFileMessage = Disabled page file for drive {0}. 10 | EnabledSystemManagedSizeMessage = Enabled system managed page file for drive {0}. 11 | EnabledCustomSizeMessage = Enabled custom size page file for drive {0}. 12 | DriveNotReadyError = Drive {0} is not ready. Please ensure that the drive exists and is available. 13 | TestingVirtualMemoryMessage = Testing Virtual Memory. 14 | '@ 15 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_WindowsCapability/DSC_WindowsCapability.schema.mof: -------------------------------------------------------------------------------- 1 | 2 | [ClassVersion("1.0.0.1"), FriendlyName("WindowsCapability")] 3 | class DSC_WindowsCapability : OMI_BaseResource 4 | { 5 | [Key, Description("Specifies the name of the Windows Capability.")] String Name; 6 | [Write, Description("Specifies whether the Windows Capability should be installed or uninstalled. To install the Windows Capability, set this property to Present. To uninstall the Windows Capability, set the property to Absent."), ValueMap{"Present", "Absent"}, Values{"Present", "Absent"}] String Ensure; 7 | [Write, Description("Specifies the given Log Level of a Windows Capability. This is a write only parameter that is used when updating the status of a Windows Capability. If not specified, the default is 'WarningsInfo'."), ValueMap{"Errors", "Warnings", "WarningsInfo"}, Values{"Errors", "Warnings", "WarningsInfo"}] String LogLevel; 8 | [Write, Description("Specifies the full path and file name to log to. This is a write only parameter that is used when updating the status of a Windows Capability. If not specified, the default is '%WINDIR%\\Logs\\Dism\\dism.log'.")] String LogPath; 9 | [Write, Description("Specifies the location of the files that are required to add a Windows capability package to an image. You can specify the Windows directory of a mounted image or a running Windows installation that is shared on the network.")] String Source; 10 | }; 11 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_WindowsCapability/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | This resource enables installation or removal of a Windows Capability. 4 | 5 | The LogLevel and LogPath parameters can be passed to the resource but 6 | are not used to determine if the resource is in the desired state. 7 | 8 | This is because the LogLevel and LogPath properties returned by 9 | `Get-WindowsCapability` do not reflect the values that may have been 10 | set with `Add-WindowsCapability` or `Remove-WindowsCapability`. 11 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_WindowsCapability/en-US/DSC_WindowsCapability.strings.psd1: -------------------------------------------------------------------------------- 1 | # culture ="en-US" 2 | ConvertFrom-StringData -StringData @' 3 | SetResourceIsInDesiredState = Windows Capability '{0}' is in desired state. 4 | SetResourceIsNotInDesiredState = Windows Capability '{0}' is not in desired state. 5 | GetTargetResourceStartMessage = Begin executing Get functionality on Windows Capability '{0}'. 6 | GetTargetResourceEndMessage = End executing Get functionality on Windows Capability '{0}'. 7 | SetTargetResourceStartMessage = Begin executing Set functionality on Windows Capability '{0}'. 8 | SetTargetRemoveMessage = Executing Remove functionality on Windows Capability '{0}'. 9 | SetTargetAddMessage = Executing Add functionality on Windows Capability '{0}'. 10 | TestTargetResourceStartMessage = Begin executing Test functionality on Windows Capability '{0}'. 11 | CapabilityNameFound = Specified Windows Capability '{0}' found. 12 | CapabilityNameNotFound = Specified Windows Capability '{0}' not found. 13 | '@ 14 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_WindowsEventLog/DSC_WindowsEventLog.schema.mof: -------------------------------------------------------------------------------- 1 | 2 | [ClassVersion("1.0.0.1"), FriendlyName("WindowsEventLog")] 3 | class DSC_WindowsEventLog : OMI_BaseResource 4 | { 5 | [Key, Description("Specifies the name of a valid event log")] String LogName; 6 | [Write, Description("Specifies whether the specified event log should be enabled or disabled")] Boolean IsEnabled; 7 | [Write, Description("Specifies the maximum size in bytes for the specified event log")] Sint64 MaximumSizeInBytes; 8 | [Write, Description("Specifies the log mode for the specified event log"), ValueMap{"AutoBackup","Circular","Retain"}, Values{"AutoBackup","Circular","Retain"}] String LogMode; 9 | [Write, Description("Specifies the SDDL for the specified event log")] String SecurityDescriptor; 10 | [Write, Description("Specifies the file name and path for the specified event log")] String LogFilePath; 11 | [Write, Description("Specifies the number of days to retain events when the log mode is AutoBackup")] Sint32 LogRetentionDays; 12 | [Write, Description("Specifies the name of an event source to register for the specified event log")] String RegisteredSource; 13 | [Write, Description("Specifies the category resource file for the event source")] String CategoryResourceFile; 14 | [Write, Description("Specifies the message resource file for the event source")] String MessageResourceFile; 15 | [Write, Description("Specifies the parameter resource file for the event source")] String ParameterResourceFile; 16 | [Write, Description("Specifies whether to allow guests to have access to the specified event log")] Boolean RestrictGuestAccess; 17 | }; 18 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_WindowsEventLog/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | This resource is used to configure the settings of an event log. 4 | 5 | ## RestrictGuestAccess and Event Log DACLs 6 | 7 | If you choose to restrict guest access to an event log, the 8 | RestrictGuestAccess registry key will be configured and the event 9 | log's DACL will be checked and updated to ensure the built-in 10 | Guests group has been removed. Conversely, if you choose to 11 | allow guest access, the registry key will be configured and the 12 | DACL will be checked and updated to ensure the built-in Guests 13 | group has been added. 14 | 15 | This DACL behavior also applies if you configure your own custom 16 | DACL via the SecurityDescriptor property and a warning will be 17 | displayed to notify you of the change. 18 | 19 | ## RegisteredSource and Resource Files 20 | 21 | The PowerShell cmdlets that define event log sources do not check 22 | for the presence of the resource file on the computer and this 23 | resource follows the same paradigm. If you choose to create your 24 | own resource files and want to register them with the event source, 25 | you must ensure the files have been copied to the computer via a 26 | DSC File resource definition or equivalent. 27 | -------------------------------------------------------------------------------- /source/DSCResources/DSC_WindowsEventLog/en-US/DSC_WindowsEventLog.strings.psd1: -------------------------------------------------------------------------------- 1 | # Culture = "en-US" 2 | ConvertFrom-StringData -StringData @' 3 | GetTargetResource = Getting the current state of event log '{0}'. 4 | GetWindowsEventLogFailure = Unable to retrieve event log '{0}' because it was not found. 5 | GetWindowsEventLogRetentionDaysFailure = Unable to retrieve the current retention for event log '{0}' because it was not found. 6 | ModifySystemProvidedSecurityDescriptor = The SecurityDescriptor property (provided by the system) will be modified to ensure alignment with the RestrictGuestAccess property. 7 | ModifyUserProvidedSecurityDescriptor = The SecurityDescriptor property (provided by the user) will be modified to ensure alignment with the RestrictGuestAccess property. 8 | RegisterWindowsEventLogSourceFailure = An error occurred trying to register '{1}' for event log '{0}'. 9 | RegisterWindowsEventLogSourceInvalidPath = Unable to register '{1}' for event source '{0}' because the path is invalid. 10 | SaveWindowsEventLogFailure = An error occurred trying to save the properties for event log '{0}'. 11 | SetWindowsEventLogRestrictGuestAccessFailure = An error occurred trying to configure restricted guest access for event log '{0}'. 12 | SetWindowsEventLogRetentionDaysFailure = An error occurred trying to configure retention for event log '{0}'. 13 | SetWindowsEventLogRetentionDaysWrongMode = Unable to configure retention for event log '{0}' because LogMode must be set to AutoBackup. 14 | SetWindowsEventLogRetentionDaysNotClassic = Unable to configure retention for event log '{0}' because it not a classic event log. 15 | SetTargetResourceProperty = Setting the '{1}' property of event log '{0}'. Current value '{2}'. Requested value '{3}'. 16 | TestTargetResourcePropertyNotInDesiredState = The '{1}' property of event log '{0}' is not in the desired state. Current value '{2}'. Requested value '{3}'. 17 | '@ 18 | -------------------------------------------------------------------------------- /source/Examples/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Examples 3 | 4 | This will help to understand how to setup certain scenarios with ComputerManagementDsc 5 | resource module. 6 | 7 | ## Resource examples 8 | 9 | These are the links to the examples for each individual resource. 10 | 11 | - [Computer](Resources/Computer) 12 | - [IEEnhancedSecurityConfiguration](Resources/IEEnhancedSecurityConfiguration) 13 | - [OfflineDomainJoin](Resources/OfflineDomainJoin) 14 | - [PendingReboot](Resources/PendingReboot) 15 | - [PowerPlan](Resources/PowerPlan) 16 | - [PowerShellExecutionPolicy](Resources/PowerShellExecutionPolicy) 17 | - [PSResourceRepository](Resources/PSResourceRepository) 18 | - [RemoteDesktopAdmin](Resources/RemoteDesktopAdmin) 19 | - [ScheduledTask](Resources/ScheduledTask) 20 | - [SmbServerConfiguration](Resources/SmbServerConfiguration) 21 | - [SmbShare](Resources/SmbShare) 22 | - [SystemLocale](Resources/SystemLocale) 23 | - [TimeZone](Resources/TimeZone) 24 | - [UserAccountControl](Resources/UserAccountControl) 25 | - [VirtualMemory](Resources/VirtualMemory) 26 | - [WindowsCapability](Resources/WindowsCapability) 27 | - [WindowsEventLog](Resources/WindowsEventLog) 28 | -------------------------------------------------------------------------------- /source/Examples/Resources/Computer/1-Computer_RenameComputerAndSetWorkgroup_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 594bfeff-8e83-4cc4-8141-f3b39795c85b 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This configuration will set the computer name to 'Server01' 23 | and make it part of 'ContosoWorkgroup' Workgroup. 24 | #> 25 | Configuration Computer_RenameComputerAndSetWorkgroup_Config 26 | { 27 | Import-DscResource -Module ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | Computer NewNameAndWorkgroup 32 | { 33 | Name = 'Server01' 34 | WorkGroupName = 'ContosoWorkgroup' 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/Examples/Resources/Computer/2-Computer_JoinDomain_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID a8b9b735-a13d-4901-8edd-a2eb3a589183 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This configuration sets the machine name to 'Server01' and 23 | joins the 'Contoso' domain. 24 | Note: this requires an AD credential to join the domain. 25 | #> 26 | Configuration Computer_JoinDomain_Config 27 | { 28 | param 29 | ( 30 | [Parameter(Mandatory = $true)] 31 | [ValidateNotNullorEmpty()] 32 | [System.Management.Automation.PSCredential] 33 | $Credential 34 | ) 35 | 36 | Import-DscResource -Module ComputerManagementDsc 37 | 38 | Node localhost 39 | { 40 | Computer JoinDomain 41 | { 42 | Name = 'Server01' 43 | DomainName = 'Contoso' 44 | Credential = $Credential # Credential to join to domain 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/Examples/Resources/Computer/3-Computer_RenameComputerInDomain_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 7e77ef8f-69ac-4e86-8a95-e38d3350118f 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example will change the machines name 'Server01' while remaining 23 | joined to the current domain. 24 | Note: this requires a credential for renaming the machine on the 25 | domain. 26 | #> 27 | Configuration Computer_RenameComputerInDomain_Config 28 | { 29 | param 30 | ( 31 | [Parameter(Mandatory = $true)] 32 | [ValidateNotNullorEmpty()] 33 | [System.Management.Automation.PSCredential] 34 | $Credential 35 | ) 36 | 37 | Import-DscResource -Module ComputerManagementDsc 38 | 39 | Node localhost 40 | { 41 | Computer NewName 42 | { 43 | Name = 'Server01' 44 | Credential = $Credential # Domain credential 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/Examples/Resources/Computer/4-Computer_RenameComputerInWorkgroup_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 7a5bc1c3-5229-48ec-9145-816d02e4544d 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example will set the machine name to 'Server01' while remaining 23 | in the workgroup. 24 | #> 25 | Configuration Computer_RenameComputerInWorkgroup_Config 26 | { 27 | Import-DscResource -Module ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | Computer NewName 32 | { 33 | Name = 'Server01' 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /source/Examples/Resources/Computer/5-Computer_UnjoinDomainAndJoinWorkgroup_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 9625caff-9065-4d04-9585-934998d81591 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example switches the computer 'Server01' from a domain and joins it 23 | to the 'ContosoWorkgroup' Workgroup. 24 | Note: this requires a credential. 25 | #> 26 | Configuration Computer_UnjoinDomainAndJoinWorkgroup_Config 27 | { 28 | param 29 | ( 30 | [Parameter(Mandatory = $true)] 31 | [ValidateNotNullorEmpty()] 32 | [System.Management.Automation.PSCredential] 33 | $Credential 34 | ) 35 | 36 | Import-DscResource -Module ComputerManagementDsc 37 | 38 | Node localhost 39 | { 40 | Computer JoinWorkgroup 41 | { 42 | Name = 'Server01' 43 | WorkGroupName = 'ContosoWorkgroup' 44 | Credential = $Credential # Credential to unjoin from domain 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/Examples/Resources/Computer/6-Computer_SetComputerDescriptionInWorkgroup_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 315d9349-c340-4c6d-970e-8e5d2bb5b12b 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example will set the computer description. 23 | #> 24 | Configuration Computer_SetComputerDescriptionInWorkgroup_Config 25 | { 26 | Import-DscResource -Module ComputerManagementDsc 27 | 28 | Node localhost 29 | { 30 | Computer NewDescription 31 | { 32 | Name = 'localhost' 33 | Description = 'This is my computer.' 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /source/Examples/Resources/Computer/7-Computer_JoinDomainSpecifyingDC_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 5964d0b3-be15-455e-8233-4f655150de79 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This configuration sets the machine name to 'Server01' and 23 | joins the 'Contoso' domain using the domain controller 'dc1.contoso.com'. 24 | Note: this requires an AD credential to join the domain. 25 | #> 26 | Configuration Computer_JoinDomainSpecifyingDC_Config 27 | { 28 | param 29 | ( 30 | [Parameter(Mandatory = $true)] 31 | [ValidateNotNullorEmpty()] 32 | [System.Management.Automation.PSCredential] 33 | $Credential 34 | ) 35 | 36 | Import-DscResource -Module ComputerManagementDsc 37 | 38 | Node localhost 39 | { 40 | Computer JoinDomain 41 | { 42 | Name = 'Server01' 43 | DomainName = 'Contoso' 44 | Credential = $Credential # Credential to join to domain 45 | Server = 'dc1.contoso.com' 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /source/Examples/Resources/IEEnhancedSecurityConfiguration/1-IEEnhancedSecurityConfiguration_DisableForAdministrators_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID d54a9117-8468-4cb1-958b-25837f15126b 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This configuration will disable the IE Enhanced Security Configuration for 23 | administrators. 24 | #> 25 | Configuration IEEnhancedSecurityConfiguration_DisableForAdministrators_Config 26 | { 27 | Import-DscResource -Module ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | IEEnhancedSecurityConfiguration 'DisableForAdministrators' 32 | { 33 | Role = 'Administrators' 34 | Enabled = $false 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/Examples/Resources/IEEnhancedSecurityConfiguration/2-IEEnhancedSecurityConfiguration_DisableForUsers_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 4afcbf49-6290-4039-a1f1-965a721f6f49 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This configuration will disable the IE Enhanced Security Configuration for 23 | users. 24 | #> 25 | Configuration IEEnhancedSecurityConfiguration_DisableForUsers_Config 26 | { 27 | Import-DscResource -Module ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | IEEnhancedSecurityConfiguration 'DisableForUsers' 32 | { 33 | Role = 'Users' 34 | Enabled = $false 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/Examples/Resources/OfflineDomainJoin/1-OfflineDomainJoin_JoinDomainUsingODJBlob_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID fc143221-396c-4407-9aa8-c5878326e4ff 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example will join the computer to a domain using the ODJ 23 | request file C:\ODJ\ODJRequest.txt. 24 | #> 25 | Configuration OfflineDomainJoin_JoinDomainUsingODJBlob_Config 26 | { 27 | Import-DscResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | OfflineDomainJoin ODJ 32 | { 33 | IsSingleInstance = 'Yes' 34 | RequestFile = 'C:\ODJ\ODJBlob.txt' 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/Examples/Resources/PSResourceRepository/1-Register_PSGallery_Present.ps1: -------------------------------------------------------------------------------- 1 | #Requires -module ComputerManagementDsc 2 | 3 | <# 4 | .DESCRIPTION 5 | This configuration adds the PSGallery PSRepository to a machine 6 | #> 7 | 8 | configuration Register_PSGallery_Present 9 | { 10 | Import-DscResource -ModuleName 'ComputerManagementDsc' 11 | 12 | node localhost 13 | { 14 | PSResourceRepository 'Register PSGallery PSRepository' 15 | { 16 | Name = 'PSGallery' 17 | Ensure = 'Present' 18 | Default = $true 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /source/Examples/Resources/PSResourceRepository/2-Register_PSRepository_Present.ps1: -------------------------------------------------------------------------------- 1 | #Requires -module ComputerManagementDsc 2 | 3 | <# 4 | .DESCRIPTION 5 | This configuration adds the PSRepository named MyPSRepository to a machine 6 | #> 7 | 8 | configuration Register_PSRepository_Present 9 | { 10 | Import-DscResource -ModuleName 'ComputerManagementDsc' 11 | 12 | node localhost 13 | { 14 | PSResourceRepository 'Register MyPSRepository PSRepository' 15 | { 16 | Name = 'MyPSRepository' 17 | SourceLocation = 'https://www.mypsrepository.com/api/v2' 18 | ScriptSourceLocation = 'https://www.mypsrepository.com/api/v2/package/' 19 | PublishLocation = 'https://www.mypsrepository.com/api/v2/items/psscript' 20 | ScriptPublishLocation = 'https://www.mypsrepository.com/api/v2/package/' 21 | InstallationPolicy = 'Trusted' 22 | PackageManagementProvider = 'NuGet' 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /source/Examples/Resources/PSResourceRepository/3-Repository_Absent.ps1: -------------------------------------------------------------------------------- 1 | #Requires -module ComputerManagementDsc 2 | 3 | <# 4 | .DESCRIPTION 5 | This configuration removes the PSGallery PSRepository from a machine 6 | #> 7 | 8 | configuration Repository_Absent 9 | { 10 | Import-DscResource -ModuleName 'ComputerManagementDsc' 11 | 12 | node localhost 13 | { 14 | PSResourceRepository 'Remove PSGallery PSRepository' 15 | { 16 | Name = 'PSGallery' 17 | Ensure = 'Absent' 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /source/Examples/Resources/PendingReboot/1-PendingReboot_RebootAfterDomainJoin_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID ca17d716-4ded-4822-8f02-6363e9fa2c71 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example joins a computer to a domain and allows the LCM 23 | node to reboot after the join. The LCM must have been configured 24 | with the RebootNodeIfNeeded property set to $true. 25 | #> 26 | Configuration PendingReboot_RebootAfterDomainJoin_Config 27 | { 28 | param 29 | ( 30 | [Parameter(Mandatory = $true)] 31 | [ValidateNotNullorEmpty()] 32 | [System.Management.Automation.PSCredential] 33 | $Credential 34 | ) 35 | 36 | Import-DscResource -ModuleName ComputerManagementDsc 37 | 38 | Node localhost 39 | { 40 | Computer JoinDomain 41 | { 42 | Name = 'Server01' 43 | DomainName = 'Contoso' 44 | Credential = $Credential # Credential to join to domain 45 | } 46 | 47 | PendingReboot RebootAfterDomainJoin 48 | { 49 | Name = 'DomainJoin' 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /source/Examples/Resources/PendingReboot/2-PendingReboot_ConfigMgrReboot_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 0d920405-2238-4ab5-871a-995e9baa0e28 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example sets the timezone of the node to Tonga Standard Time 23 | and then allows the LCM node to reboot the node only if System 24 | Center Configuration Manager requires a reboot. No other reboot 25 | trigger will cause the LCM to reboot the node. 26 | #> 27 | Configuration PendingReboot_ConfigMgrReboot_Config 28 | { 29 | Import-DscResource -ModuleName ComputerManagementDsc 30 | 31 | Node localhost 32 | { 33 | TimeZone TimeZoneExample 34 | { 35 | IsSingleInstance = 'Yes' 36 | TimeZone = 'Tonga Standard Time' 37 | } 38 | 39 | PendingReboot ConfigMgrReboot 40 | { 41 | Name = 'ConfigMgr' 42 | SkipComponentBasedServicing = $true 43 | SkipWindowsUpdate = $true 44 | SkipPendingFileRename = $true 45 | SkipPendingComputerRename = $true 46 | SkipCcmClientSDK = $false 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /source/Examples/Resources/PowerPlan/1-PowerPlan_SetPowerPlan_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 547354f3-f5d1-4c76-8988-72887938e852 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This examples sets the active power plan to the 'High performance' plan. 23 | #> 24 | Configuration PowerPlan_SetPowerPlan_Config 25 | { 26 | Import-DscResource -ModuleName ComputerManagementDsc 27 | 28 | Node localhost 29 | { 30 | PowerPlan SetPlanHighPerformance 31 | { 32 | IsSingleInstance = 'Yes' 33 | Name = 'High performance' 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /source/Examples/Resources/PowerShellExecutionPolicy/1-PowerShellExecutionPolicy_SetPolicy_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID d878a4e7-da0b-4099-b8e3-3442717b4c97 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example shows how to configure powershell's execution policy for the specified execution policy scope. 23 | #> 24 | Configuration PowerShellExecutionPolicy_SetPolicy_Config 25 | { 26 | Import-DscResource -ModuleName ComputerManagementDsc 27 | 28 | Node localhost 29 | { 30 | PowerShellExecutionPolicy ExecutionPolicy 31 | { 32 | ExecutionPolicyScope = 'CurrentUser' 33 | ExecutionPolicy = 'RemoteSigned' 34 | } # End of PowershellExecutionPolicy Resource 35 | } # End of Node 36 | } # End of Configuration 37 | -------------------------------------------------------------------------------- /source/Examples/Resources/PowerShellExecutionPolicy/2-PowerShellExecutionPolicy_SetPolicyForMultipleScopes_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 6900f247-5477-4821-9718-480f485db688 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example shows how to configure multiple powershell's execution policy for a specified execution policy scope. 23 | #> 24 | Configuration PowerShellExecutionPolicy_SetPolicyForMultipleScopes_Config 25 | { 26 | Import-DscResource -ModuleName ComputerManagementDsc 27 | 28 | Node localhost 29 | { 30 | PowerShellExecutionPolicy ExecutionPolicyCurrentUser 31 | { 32 | ExecutionPolicyScope = 'CurrentUser' 33 | ExecutionPolicy = 'RemoteSigned' 34 | } # End of ExecutionPolicyCurrentUser Resource 35 | 36 | PowerShellExecutionPolicy ExecutionPolicyLocalMachine 37 | { 38 | ExecutionPolicyScope = 'LocalMachine' 39 | ExecutionPolicy = 'RemoteSigned' 40 | } # End of ExecutionPolicyLocalMachine Resource 41 | } # End of Node 42 | } # End of Configuration 43 | -------------------------------------------------------------------------------- /source/Examples/Resources/RemoteDesktopAdmin/1-RemoteDesktopAdmin_SetSecureRemoteDesktopAdmin_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID f177571b-c54b-46f2-9d55-903b794ecccd 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This configuration will enable Remote Desktop for Administration and set 23 | the User Authentication to secure, i.e. to require Network Level Authentication 24 | #> 25 | 26 | Configuration RemoteDesktopAdmin_SetSecureRemoteDesktopAdmin_Config 27 | { 28 | Import-DscResource -Module ComputerManagementDsc 29 | 30 | Node ('localhost') 31 | { 32 | RemoteDesktopAdmin RemoteDesktopSettings 33 | { 34 | IsSingleInstance = 'yes' 35 | Ensure = 'Present' 36 | UserAuthentication = 'Secure' 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/1-ScheduledTask_CreateScheduledTaskOnce_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 4310a6c2-9f34-4ebc-8895-feda5286e532 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates a scheduled task called 'Test task Once' in the folder 23 | task folder 'MyTasks' that starts a new powershell process once at 00:00 repeating 24 | every 15 minutes for 8 hours. The task is delayed by a random amount up to 1 hour 25 | each time. The task will run even if the previous task is still running and it 26 | will prevent hard terminating of the previously running task instance. The task 27 | execution will have no time limit. 28 | #> 29 | Configuration ScheduledTask_CreateScheduledTaskOnce_Config 30 | { 31 | Import-DscResource -ModuleName ComputerManagementDsc 32 | 33 | Node localhost 34 | { 35 | ScheduledTask ScheduledTaskOnceAdd 36 | { 37 | TaskName = 'Test task Once' 38 | TaskPath = '\MyTasks' 39 | ActionExecutable = 'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' 40 | ScheduleType = 'Once' 41 | RepeatInterval = '00:15:00' 42 | RepetitionDuration = '08:00:00' 43 | ExecutionTimeLimit = '00:00:00' 44 | ActionWorkingPath = (Get-Location).Path 45 | Enable = $true 46 | RandomDelay = '01:00:00' 47 | DisallowHardTerminate = $true 48 | RunOnlyIfIdle = $false 49 | Priority = 9 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/10-ScheduledTask_RunPowerShellTaskOnceAsUserInteractiveOnly_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 0323fac5-e026-4f41-a9be-9fdcd0967b60 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates a scheduled task called 'Test task interactive' in the folder 23 | task folder 'MyTasks' that starts a new powershell process once. The task will 24 | execute using the credential passed into the $Credential parameter, but only when 25 | the user contained in the $Credential is logged on. 26 | #> 27 | Configuration ScheduledTask_RunPowerShellTaskOnceAsUserInteractiveOnly_Config 28 | { 29 | param 30 | ( 31 | [Parameter(Mandatory = $true)] 32 | [ValidateNotNullorEmpty()] 33 | [System.Management.Automation.PSCredential] 34 | $Credential 35 | ) 36 | 37 | Import-DscResource -ModuleName ComputerManagementDsc 38 | 39 | Node localhost 40 | { 41 | ScheduledTask MaintenanceScriptExample 42 | { 43 | TaskName = 'Test task Interactive' 44 | TaskPath = '\MyTasks' 45 | ActionExecutable = 'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' 46 | ScheduleType = 'Once' 47 | ActionWorkingPath = (Get-Location).Path 48 | Enable = $true 49 | ExecuteAsCredential = $Credential 50 | LogonType = 'Interactive' 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/11-ScheduledTask_DisableABuiltInTask_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID c3422e70-79ea-4afa-9558-1fcbe18dd0bd 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example disables the built-in scheduled task called 23 | 'CreateExplorerShellUnelevatedTask'. 24 | #> 25 | Configuration ScheduledTask_DisableABuiltInTask_Config 26 | { 27 | Import-DscResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | ScheduledTask DisableCreateExplorerShellUnelevatedTask 32 | { 33 | TaskName = 'CreateExplorerShellUnelevatedTask' 34 | TaskPath = '\' 35 | Enable = $false 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/12-ScheduledTask_DeleteABuiltInTask_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 8bed07fe-c88f-4a22-bdd8-8ec95cf8739b 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example deletes the built-in scheduled task called 23 | 'CreateExplorerShellUnelevatedTask'. 24 | #> 25 | Configuration ScheduledTask_DeleteABuiltInTask_Config 26 | { 27 | Import-DscResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | ScheduledTask DeleteCreateExplorerShellUnelevatedTask 32 | { 33 | TaskName = 'CreateExplorerShellUnelevatedTask' 34 | TaskPath = '\' 35 | Ensure = 'Absent' 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/13-ScheduledTask_CreateScheduledTasksOnEvent_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID cff7293a-5b43-491c-9628-d6eca35c8bfd 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates a scheduled task called 'TriggerOnServiceFailures' in the folder 23 | root folder. The task is delayed by exactly 30 seconds each time. The task will run when 24 | an error event 7001 of source Service Control Manager is generated in the system log. 25 | When a service crashes, it waits for 30 seconds and then starts a new PowerShell instance, 26 | in which the file c:\temp\seeme.txt gets created with the value 'Worked!' 27 | #> 28 | Configuration ScheduledTask_CreateScheduledTasksOnEvent_Config 29 | { 30 | Import-DscResource -ModuleName ComputerManagementDsc 31 | 32 | Node localhost 33 | { 34 | ScheduledTask ServiceEventManager 35 | { 36 | TaskName = 'TriggerOnServiceFailures' 37 | Ensure = 'Present' 38 | ScheduleType = 'OnEvent' 39 | ActionExecutable = 'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' 40 | ActionArguments = '-Command Set-Content -Path c:\temp\seeme.txt -Value ''$(Service) $(DependsOnService) $(ErrorCode) Worked!''' 41 | EventSubscription = '' 42 | EventValueQueries = @{ 43 | "Service" = "Event/EventData/Data[@Name='param1']" 44 | "DependsOnService" = "Event/EventData/Data[@Name='param2']" 45 | "ErrorCode" = "Event/EventData/Data[@Name='param3']" 46 | } 47 | Delay = '00:00:30' 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/14-ScheduledTask_RunPowerShellTaskOnceAsGroupManagedServiceAccount_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID cc614ca9-5994-48fb-9528-46107b3eea91 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates a scheduled task called 'Test task Run As gMSA' 23 | in the folder task folder 'MyTasks' that starts a new powershell process once. 24 | The task will run as the user passed into the ExecuteAsGMSA parameter. 25 | #> 26 | Configuration ScheduledTask_RunPowerShellTaskOnceAsGroupManagedServiceAccount_Config 27 | { 28 | param 29 | ( 30 | # Group Managed Service Account must be in the form of DOMAIN\gMSA$ or user@domain.fqdn (UPN) 31 | [Parameter()] 32 | [ValidatePattern('^\w+\\\w+\$$|\w+@\w+\.\w+')] 33 | [System.String] 34 | $GroupManagedServiceAccount = 'DOMAIN\gMSA$' 35 | ) 36 | 37 | Import-DscResource -ModuleName ComputerManagementDsc 38 | 39 | Node localhost 40 | { 41 | ScheduledTask MaintenanceScriptExample 42 | { 43 | TaskName = 'Test task Run As gMSA' 44 | TaskPath = '\MyTasks' 45 | ActionExecutable = 'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' 46 | ScheduleType = 'Once' 47 | ActionWorkingPath = (Get-Location).Path 48 | Enable = $true 49 | ExecuteAsGMSA = $GroupManagedServiceAccount 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/15-ScheduledTask_CreateScheduledTaskOnceSynchronizeAcrossTimeZoneEnabled_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID ee32fb99-4150-4616-a46c-d2132ffb5205 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates a scheduled task called 'Test task sync across time zone enabled' 23 | in the folder 'MyTasks' that starts a new powershell process once at 2018-10-01 01:00 24 | in the -08:00 timezone. The task will have the option Synchronize across time zone enabled. 25 | #> 26 | Configuration ScheduledTask_CreateScheduledTaskOnceSynchronizeAcrossTimeZoneEnabled_Config 27 | { 28 | Import-DscResource -ModuleName ComputerManagementDsc 29 | 30 | Node localhost 31 | { 32 | ScheduledTask ScheduledTaskOnceSynchronizeAcrossTimeZoneEnabled 33 | { 34 | TaskName = 'Test task sync across time zone enabled' 35 | TaskPath = '\MyTasks\' 36 | ActionExecutable = 'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' 37 | ScheduleType = 'Once' 38 | StartTime = '2018-10-01T01:00:00-08:00' 39 | SynchronizeAcrossTimeZone = $true 40 | ActionWorkingPath = (Get-Location).Path 41 | Enable = $true 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/16-ScheduledTask_CreateScheduledTasksAsBuiltInServiceAccount_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID a2984c97-f4fc-4936-b5d7-f8ccf726744f 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates a scheduled task called 'Test As NetworkService' in 23 | the folder root folder. The task is set to run every 15 minutes. 24 | When run the task will start a new PowerShell instance running as the 25 | builtin user NETWORK SERVICE. 26 | The PowerShell instance will write the value of $env:USERNAME to the 27 | file c:\temp\seeme.txt. 28 | The contents of c:\temp\seeme.txt should be "NETWORK SERVICE". 29 | #> 30 | Configuration ScheduledTask_CreateScheduledTasksAsBuiltInServiceAccount_Config 31 | { 32 | Import-DscResource -ModuleName ComputerManagementDsc 33 | 34 | Node localhost 35 | { 36 | ScheduledTask ScheduledTaskAsNetworkService 37 | { 38 | TaskName = 'Test As NetworkService' 39 | Ensure = 'Present' 40 | ActionExecutable = 'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' 41 | ActionArguments = '-Command Set-Content -Path c:\temp\seeme.txt -Value $env:USERNAME -Force' 42 | ScheduleType = 'Once' 43 | RepeatInterval = '00:15:00' 44 | RepetitionDuration = '4.00:00:00' 45 | BuiltInAccount = 'NETWORK SERVICE' 46 | } 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/17-ScheduledTask_CreateScheduledTasksOnIdle_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 2d524871-2a87-43d2-be20-ba4cf0f529f4 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates a scheduled task called 'Test task Idle' in the folder 23 | task folder 'MyTasks' that starts a new powershell process when the computer 24 | is idle. The computer must be idle for 10 minutes and Task Scheduler waits 25 | 1 hour for the idle condition to occur. Task Scheduler should stop the task if 26 | the computer ceases to be idle, and restarts the tasks if the idle state resumes. 27 | #> 28 | Configuration ScheduledTask_CreateScheduledTasksOnIdle_Config 29 | { 30 | Import-DscResource -ModuleName ComputerManagementDsc 31 | 32 | Node localhost 33 | { 34 | ScheduledTask ScheduledTaskOnIdleAdd 35 | { 36 | TaskName = 'Test task Idle' 37 | TaskPath = '\MyTasks' 38 | Ensure = 'Present' 39 | ScheduleType = 'OnIdle' 40 | ActionExecutable = 'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' 41 | IdleDuration = '00:10:00' 42 | IdleWaitTimeout = '01:00:00' 43 | DontStopOnIdleEnd = $false 44 | RestartOnIdle = $true 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/18-ScheduledTask_CreateScheduledTasksAtCreation_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID c7e3df37-31a5-4034-b593-a1ada74ec3bd 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates a scheduled task called 'Test task Creation Modification' in 23 | the folder task folder 'MyTasks' that starts a new powershell process when the task 24 | is created or modified. The initial task trigger will be delayed for 10 minutes. 25 | #> 26 | Configuration ScheduledTask_CreateScheduledTasksAtCreation_Config 27 | { 28 | Import-DscResource -ModuleName ComputerManagementDsc 29 | 30 | Node localhost 31 | { 32 | ScheduledTask ScheduledTaskAtCreationAdd 33 | { 34 | TaskName = 'Test task Creation Modification' 35 | TaskPath = '\MyTasks' 36 | Ensure = 'Present' 37 | ScheduleType = 'AtCreation' 38 | ActionExecutable = 'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' 39 | Delay = '00:10:00' 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/19-ScheduledTask_CreateScheduledTasksOnSessionState_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID eb11e2d6-9b8b-4ca6-a571-d8eb2761e4af 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates a scheduled task called 'Test task Session State' in 23 | the folder task folder 'MyTasks' that starts a new powershell process when the 24 | session state changes. The task triggers only on connection by the specific user 25 | 'Domain\UserName' to the local computer. The initial task trigger will be delayed 26 | for 10 minutes. 27 | #> 28 | Configuration ScheduledTask_CreateScheduledTasksOnSessionState_Config 29 | { 30 | Import-DscResource -ModuleName ComputerManagementDsc 31 | 32 | Node localhost 33 | { 34 | ScheduledTask ScheduledTaskOnSessionStateAdd 35 | { 36 | TaskName = 'Test task Session State' 37 | TaskPath = '\MyTasks' 38 | Ensure = 'Present' 39 | ScheduleType = 'OnSessionState' 40 | ActionExecutable = 'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' 41 | User = 'Domain\UserName' 42 | StateChange = 'OnConnectionFromLocalComputer' 43 | Delay = '00:10:00' 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/2-ScheduledTask_CreateScheduledTaskDaily_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID ce544d27-c44f-44d9-a771-1ae9b22b180c 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates a scheduled task called 'Test task Daily' in the folder 23 | task folder 'MyTasks' that starts a new powershell process every day at 00:00 repeating 24 | every 15 minutes for 8 hours. If the task fails it will be restarted after 5 minutes 25 | and it will be restarted a maximum of two times. It will only run if the network 26 | is connected and will wake the machine up to execute the task. 27 | #> 28 | Configuration ScheduledTask_CreateScheduledTaskDaily_Config 29 | { 30 | Import-DscResource -ModuleName ComputerManagementDsc 31 | 32 | Node localhost 33 | { 34 | ScheduledTask ScheduledTaskDailyAdd 35 | { 36 | TaskName = 'Test task Daily' 37 | TaskPath = '\MyTasks' 38 | ActionExecutable = 'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' 39 | ScheduleType = 'Daily' 40 | DaysInterval = 1 41 | RepeatInterval = '00:15:00' 42 | RepetitionDuration = '08:00:00' 43 | RestartCount = 2 44 | RestartInterval = '00:05:00' 45 | RunOnlyIfNetworkAvailable = $true 46 | WakeToRun = $true 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/3-ScheduledTask_CreateScheduledTasksDailyIndefinitely_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID ae57d854-a9ae-4b3b-808d-3f23423beb29 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates a scheduled task called 'Test task Daily Indefinitely' in the folder 23 | task folder 'MyTasks' that starts a new powershell process every day at 00:00 repeating 24 | every 15 minutes indefinitely. 25 | #> 26 | Configuration ScheduledTask_CreateScheduledTasksDailyIndefinitely_Config 27 | { 28 | Import-DscResource -ModuleName ComputerManagementDsc 29 | 30 | Node localhost 31 | { 32 | ScheduledTask ScheduledTaskDailyIndefinitelyAdd 33 | { 34 | TaskName = 'Test task Daily Indefinitely' 35 | TaskPath = '\MyTasks' 36 | ActionExecutable = 'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' 37 | ScheduleType = 'Daily' 38 | DaysInterval = 1 39 | RepeatInterval = '00:15:00' 40 | RepetitionDuration = 'Indefinitely' 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/4-ScheduledTask_CreateScheduledTasksWeekly_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 8817eedf-02f5-4477-8b2d-55fa73f33902 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates a scheduled task called 'Test task Weekly' in the folder 23 | task folder 'MyTasks' that starts a new powershell process every week on 24 | Monday, Wednesday and Saturday at 00:00 repeating every 15 minutes for 8 hours. 25 | The task will be hidden and will be allowed to start if the machine is running 26 | on batteries. The task will be compatible with Windows 8. 27 | #> 28 | Configuration ScheduledTask_CreateScheduledTasksWeekly_Config 29 | { 30 | Import-DscResource -ModuleName ComputerManagementDsc 31 | 32 | Node localhost 33 | { 34 | ScheduledTask ScheduledTaskWeeklyAdd 35 | { 36 | TaskName = 'Test task Weekly' 37 | TaskPath = '\MyTasks' 38 | ActionExecutable = 'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' 39 | ScheduleType = 'Weekly' 40 | WeeksInterval = 1 41 | DaysOfWeek = 'Monday', 'Wednesday', 'Saturday' 42 | RepeatInterval = '00:15:00' 43 | RepetitionDuration = '08:00:00' 44 | AllowStartIfOnBatteries = $true 45 | Compatibility = 'Win8' 46 | Hidden = $true 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/5-ScheduledTask_CreateScheduledTasksAtLogon_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 282cba27-4cf3-43b8-86f2-f6ef0f8b4489 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates a scheduled task called 'Test task Logon' in the folder 23 | task folder 'MyTasks' that starts a new powershell process when the specific 24 | user 'Domain\UserName' logs on, activating at 2018-10-01 01:00 and repeating every 25 | 15 minutes for 8 hours. All running tasks will be stopped at the end of the 26 | repetition duration. The initial task trigger will be delayed for 15 minutes. 27 | #> 28 | Configuration ScheduledTask_CreateScheduledTasksAtLogon_Config 29 | { 30 | Import-DscResource -ModuleName ComputerManagementDsc 31 | 32 | Node localhost 33 | { 34 | ScheduledTask ScheduledTaskLogonAdd 35 | { 36 | TaskName = 'Test task Logon' 37 | TaskPath = '\MyTasks' 38 | ActionExecutable = 'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' 39 | ScheduleType = 'AtLogon' 40 | StartTime = '2018-10-01T01:00:00' 41 | RepeatInterval = '00:15:00' 42 | RepetitionDuration = '08:00:00' 43 | StopAtDurationEnd = $true 44 | User = 'Domain\UserName' 45 | Delay = '00:15:00' 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/6-ScheduledTask_CreateScheduledTasksAtStartup_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID d5cfbf76-5123-48bb-a856-5ea44504b4eb 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates a scheduled task called 'Test task Startup' in the folder 23 | task folder 'MyTasks' that starts a new powershell process when the machine 24 | is started up repeating every 15 minutes for 8 hours. The initial task trigger 25 | will be delayed for 15 minutes. 26 | #> 27 | Configuration ScheduledTask_CreateScheduledTasksAtStartup_Config 28 | { 29 | Import-DscResource -ModuleName ComputerManagementDsc 30 | 31 | Node localhost 32 | { 33 | ScheduledTask ScheduledTaskStartupAdd 34 | { 35 | TaskName = 'Test task Startup' 36 | TaskPath = '\MyTasks' 37 | ActionExecutable = 'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' 38 | ScheduleType = 'AtStartup' 39 | RepeatInterval = '00:15:00' 40 | RepetitionDuration = '08:00:00' 41 | Delay = '00:15:00' 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/7-ScheduledTask_RunPowerShellTaskEvery15Minutes_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 6a249767-c480-453f-9e10-1ed7ef465d87 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example will create a scheduled task that will call PowerShell.exe every 15 23 | minutes for 4 days to run a script saved locally. The task will start immediately. 24 | The script will be called as the local system account. All running tasks will be 25 | stopped at the end of the repetition duration. 26 | #> 27 | Configuration ScheduledTask_RunPowerShellTaskEvery15Minutes_Config 28 | { 29 | Import-DscResource -ModuleName ComputerManagementDsc 30 | 31 | Node localhost 32 | { 33 | ScheduledTask MaintenanceScriptExample 34 | { 35 | TaskName = "Custom maintenance tasks" 36 | ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe" 37 | ActionArguments = "-File `"C:\scripts\my custom script.ps1`"" 38 | ScheduleType = 'Once' 39 | RepeatInterval = '00:15:00' 40 | RepetitionDuration = '4.00:00:00' 41 | StopAtDurationEnd = $true 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/8-ScheduledTask_RunPowerShellTaskEvery15MinutesIndefinitely_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID dffe47fd-73f7-47d2-8604-f381e6c18f26 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example will create a scheduled task that will call PowerShell.exe every 15 23 | minutes indefinitely to run a script saved locally. The task will start immediately. 24 | The script will be called as the local system account. The execution time limit on 25 | the task trigger is set to 15 minutes. 26 | #> 27 | Configuration ScheduledTask_RunPowerShellTaskEvery15MinutesIndefinitely_Config 28 | { 29 | Import-DscResource -ModuleName ComputerManagementDsc 30 | 31 | Node localhost 32 | { 33 | ScheduledTask MaintenanceScriptExample 34 | { 35 | TaskName = "Custom maintenance tasks" 36 | ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe" 37 | ActionArguments = "-File `"C:\scripts\my custom script.ps1`"" 38 | ScheduleType = 'Once' 39 | RepeatInterval = '00:15:00' 40 | RepetitionDuration = 'Indefinitely' 41 | TriggerExecutionTimeLimit = '00:15:00' 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /source/Examples/Resources/ScheduledTask/9-ScheduledTask_RunPowerShellTaskOnceAsUserWithHighestPriveleges_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 718e81fa-c553-4715-8f5d-734fb8a02204 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates a scheduled task called 'Test task Run As Highest Privilege' 23 | in the folder task folder 'MyTasks' that starts a new powershell process once. 24 | The task will run as the credential passed into the $Credential parameter, running 25 | with the highest privileges. 26 | #> 27 | Configuration ScheduledTask_RunPowerShellTaskOnceAsUserWithHighestPriveleges_Config 28 | { 29 | param 30 | ( 31 | [Parameter(Mandatory = $true)] 32 | [ValidateNotNullorEmpty()] 33 | [System.Management.Automation.PSCredential] 34 | $Credential 35 | ) 36 | 37 | Import-DscResource -ModuleName ComputerManagementDsc 38 | 39 | Node localhost 40 | { 41 | ScheduledTask MaintenanceScriptExample 42 | { 43 | TaskName = 'Test task Run As Highest Privilege' 44 | TaskPath = '\MyTasks' 45 | ActionExecutable = 'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' 46 | ScheduleType = 'Once' 47 | ActionWorkingPath = (Get-Location).Path 48 | Enable = $true 49 | ExecuteAsCredential = $Credential 50 | RunLevel = 'Highest' 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /source/Examples/Resources/SmbServerConfiguration/1-SmbServerConfiguration_AllProperties_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 4a847e98-a3f9-4552-8654-6c7006ef25cf 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/c/blob/master/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example configures all supported SMB Server settings for a node 23 | to ensure they are set to known values. 24 | #> 25 | Configuration SmbServerConfiguration_AllProperties_Config 26 | { 27 | Import-DscResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | SmbServerConfiguration SmbServer 32 | { 33 | IsSingleInstance = 'Yes' 34 | AnnounceComment = 'SMB server hello' 35 | AnnounceServer = $true 36 | AsynchronousCredits = 64 37 | AuditSmb1Access = $false 38 | AutoDisconnectTimeout = 15 39 | AutoShareServer = $true 40 | AutoShareWorkstation = $true 41 | CachedOpenLimit = 10 42 | DurableHandleV2TimeoutInSeconds = 180 43 | EnableAuthenticateUserSharing = $false 44 | EnableDownlevelTimewarp = $false 45 | EnableForcedLogoff = $true 46 | EnableLeasing = $true 47 | EnableMultiChannel = $true 48 | EnableOplocks = $true 49 | EnableSecuritySignature = $false 50 | EnableSMB1Protocol = $false 51 | EnableSMB2Protocol = $true 52 | EnableStrictNameChecking = $true 53 | EncryptData = $false 54 | IrpStackSize = 15 55 | KeepAliveTime = 2 56 | MaxChannelPerSession = 32 57 | MaxMpxCount = 50 58 | MaxSessionPerConnection = 16384 59 | MaxThreadsPerQueue = 20 60 | MaxWorkItems = 1 61 | NullSessionPipes = 'NullPipe' 62 | NullSessionShares = 'NullShare' 63 | OplockBreakWait = 35 64 | PendingClientTimeoutInSeconds = 120 65 | RejectUnencryptedAccess = $true 66 | RequireSecuritySignature = $false 67 | ServerHidden = $true 68 | Smb2CreditsMax = 2048 69 | Smb2CreditsMin = 128 70 | SmbServerNameHardeningLevel = 0 71 | TreatHostAsStableStorage = $false 72 | ValidateAliasNotCircular = $true 73 | ValidateShareScope = $true 74 | ValidateShareScopeNotAliased = $true 75 | ValidateTargetName = $true 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /source/Examples/Resources/SmbServerConfiguration/1-SmbServerConfiguration_DisableSmb1_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID e1ed9aff-7171-425b-a513-6965662816d8 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example configures the SMB Server to disable SMB1. 23 | #> 24 | Configuration SmbServerConfiguration_DisableSmb1_Config 25 | { 26 | Import-DscResource -ModuleName ComputerManagementDsc 27 | 28 | Node localhost 29 | { 30 | SmbServerConfiguration SmbServer 31 | { 32 | IsSingleInstance = 'Yes' 33 | AuditSmb1Access = $false 34 | EnableSMB1Protocol = $false 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/Examples/Resources/SmbShare/1-SmbShare_CreateShare_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID d0847694-6a83-4f5b-bf6f-30cb078033bc 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates an SMB share named 'Temp' for the path 'C:\Temp', 23 | using the default values of the cmdlet `New-SmbShare`. 24 | 25 | .NOTES 26 | To know the default values, see the documentation for the cmdlet 27 | `New-SmbShare`. 28 | #> 29 | Configuration SmbShare_CreateShare_Config 30 | { 31 | Import-DscResource -ModuleName ComputerManagementDsc 32 | 33 | Node localhost 34 | { 35 | SmbShare 'TempShare' 36 | { 37 | Name = 'Temp' 38 | Path = 'C:\Temp' 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/Examples/Resources/SmbShare/2-SmbShare_CreateShareAllProperties_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 27cc4f2a-e366-49cb-93d6-2f094567ebf3 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates an SMB share named 'Temp' for the path 'C:\Temp', 23 | using specific values for each supported property. 24 | 25 | .NOTES 26 | Any other property not yet súpported will use the default values of the 27 | cmdlet `New-SmbShare`.To know the default values, see the documentation 28 | for the cmdlet `New-SmbShare`. 29 | #> 30 | Configuration SmbShare_CreateShareAllProperties_Config 31 | { 32 | Import-DscResource -ModuleName ComputerManagementDsc 33 | 34 | Node localhost 35 | { 36 | SmbShare 'TempShare' 37 | { 38 | Name = 'Temp' 39 | Path = 'C:\Temp' 40 | Description = 'Some description' 41 | ConcurrentUserLimit = 20 42 | EncryptData = $false 43 | FolderEnumerationMode = 'AccessBased' 44 | CachingMode = 'Manual' 45 | ContinuouslyAvailable = $false 46 | FullAccess = @() 47 | ChangeAccess = @('AdminUser1') 48 | ReadAccess = @('Everyone') 49 | NoAccess = @('DeniedUser1') 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /source/Examples/Resources/SmbShare/3-SmbShare_RemoveShare_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID f11d7558-0748-4a72-b743-34424cbf4407 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/c/blob/master/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example removes a SMB share named 'Temp'. 23 | 24 | .NOTES 25 | Path must be specified because it is a mandatory parameter, 26 | but it can be set to any value. 27 | #> 28 | Configuration SmbShare_RemoveShare_Config 29 | { 30 | Import-DscResource -ModuleName ComputerManagementDsc 31 | 32 | Node localhost 33 | { 34 | SmbShare 'TempShare' 35 | { 36 | Ensure = 'Absent' 37 | Name = 'Temp' 38 | Path = 'NotUsed' 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/Examples/Resources/SmbShare/4-SmbShare_RecreateShare_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID ea641782-74b4-4673-94fe-336cbd196c16 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example creates an SMB share named 'Share' for the path 'C:\Share1', 23 | using the default values of the cmdlet `New-SmbShare`. If the share 24 | already exists, it will drop the share and recreate it on the new path 25 | because Force is set to true. 26 | 27 | .NOTES 28 | To know the default values, see the documentation for the cmdlet 29 | `New-SmbShare`. 30 | #> 31 | Configuration SmbShare_RecreateShare_Config 32 | { 33 | Import-DscResource -ModuleName ComputerManagementDsc 34 | 35 | Node localhost 36 | { 37 | SmbShare 'RecreateShare' 38 | { 39 | Name = 'Share' 40 | Path = 'C:\Share1' 41 | Force = $true 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /source/Examples/Resources/SystemLocale/1-SystemLocale_SetSystemLocale_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 66476d02-bd04-4d5d-ac49-d64724716f41 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example will set the System Locale of LocalHost to 'ja-JP'. 23 | To use this example, run it using PowerShell. 24 | #> 25 | Configuration SystemLocale_SetSystemLocale_Config 26 | { 27 | param 28 | ( 29 | [Parameter()] 30 | [System.String[]] 31 | $NodeName = 'localhost' 32 | ) 33 | 34 | Import-DSCResource -ModuleName ComputerManagementDsc 35 | 36 | Node $NodeName 37 | { 38 | SystemLocale SystemLocaleExample 39 | { 40 | IsSingleInstance = 'Yes' 41 | SystemLocale = 'ja-JP' 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /source/Examples/Resources/SystemProtection/1-SystemProtection_EnableDriveC_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 4f0d0a70-30e3-4f16-86f3-76631587bdd0 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/master/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Enables system protection for the C drive using the 23 | default value of 10 percent disk usage. 24 | #> 25 | Configuration SystemProtection_EnableDriveC_Config 26 | { 27 | Import-DSCResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | SystemProtection DriveC 32 | { 33 | Ensure = 'Present' 34 | DriveLetter = 'C' 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/Examples/Resources/SystemProtection/2-SystemProtection_EnableDriveC_5Percent_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 6a49b259-754d-4825-b559-31029a10f5d7 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/master/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Enables system protection for the C drive and sets 23 | the maximum restore point disk usage to 5 percent. 24 | #> 25 | Configuration SystemProtection_EnableDriveC_5Percent_Config 26 | { 27 | Import-DSCResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | SystemProtection DriveC 32 | { 33 | Ensure = 'Present' 34 | DriveLetter = 'C' 35 | DiskUsage = 5 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/Examples/Resources/SystemProtection/3-SystemProtection_DisableDriveF_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID fbe5e8dd-1327-4d1a-aa08-06b2063b960e 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/master/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Disables system protection for the F drive. 23 | #> 24 | Configuration SystemProtection_DisableDriveF_Config 25 | { 26 | Import-DSCResource -ModuleName ComputerManagementDsc 27 | 28 | Node localhost 29 | { 30 | SystemProtection DriveF 31 | { 32 | Ensure = 'Absent' 33 | DriveLetter = 'F' 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /source/Examples/Resources/SystemProtection/4-SystemProtection_ReduceDriveCDiskUsage_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID f0e26404-16fd-407c-832a-e69b30ec43b0 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/master/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Sets the maximum disk usage for Drive C to 15 percent. 23 | Assumes the current disk usage is configured for a 24 | higher percentage and you want to delete checkpoints. 25 | #> 26 | Configuration SystemProtection_ReduceDriveCDiskUsage_Config 27 | { 28 | Import-DSCResource -ModuleName ComputerManagementDsc 29 | 30 | Node localhost 31 | { 32 | SystemProtection DriveC 33 | { 34 | Ensure = 'Present' 35 | DriveLetter = 'C' 36 | DiskUsage = 15 37 | Force = $true 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /source/Examples/Resources/SystemProtection/5-SystemProtection_MultiDrive_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID ef7f184e-1b0f-4eba-91a8-2aafe209b25c 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/master/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Enables system protection for the C drive using the 23 | default value of 10 percent disk usage and the D 24 | drive with 25 percent disk usage. 25 | #> 26 | Configuration SystemProtection_MultiDrive_Config 27 | { 28 | Import-DSCResource -ModuleName ComputerManagementDsc 29 | 30 | Node localhost 31 | { 32 | SystemProtection DriveC 33 | { 34 | Ensure = 'Present' 35 | DriveLetter = 'C' 36 | DiskUsage = 15 37 | } 38 | 39 | SystemProtection DriveD 40 | { 41 | Ensure = 'Present' 42 | DriveLetter = 'D' 43 | DiskUsage = 25 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source/Examples/Resources/SystemRestorePoint/1-SystemRestorePoint_CreateModifySettings_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID c3eab687-2f94-4321-b985-e0c128676bfe 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/master/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Creates a system restore point. 23 | #> 24 | Configuration SystemRestorePoint_CreateModifySettings_Config 25 | { 26 | Import-DSCResource -ModuleName ComputerManagementDsc 27 | 28 | Node localhost 29 | { 30 | SystemRestorePoint ModifySettings 31 | { 32 | Ensure = 'Present' 33 | Description = 'Modify system settings' 34 | RestorePointType = 'MODIFY_SETTINGS' 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/Examples/Resources/SystemRestorePoint/2-SystemRestorePoint_DeleteApplicationInstalls_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 7f114f0d-9a93-427d-a81f-2fd991fd4c65 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/master/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Deletes all restore points matching the description 23 | and the APPLICATION_INSTALL restore point type. 24 | #> 25 | Configuration SystemRestorePoint_DeleteApplicationInstalls_Config 26 | { 27 | Import-DSCResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | SystemRestorePoint DeleteTestApplicationinstalls 32 | { 33 | Ensure = 'Absent' 34 | Description = 'Test Restore Point' 35 | RestorePointType = 'APPLICATION_INSTALL' 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/Examples/Resources/TimeZone/1-TimeZone_SetTimeZone_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID d39a7d09-4baa-44d2-bcb4-b37ae3f2e16b 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This example sets the current time zone on the node 23 | to 'Tonga Standard Time'. 24 | #> 25 | Configuration TimeZone_SetTimeZone_Config 26 | { 27 | Import-DSCResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | TimeZone TimeZoneExample 32 | { 33 | IsSingleInstance = 'Yes' 34 | TimeZone = 'Tonga Standard Time' 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/Examples/Resources/UserAccountControl/1-UserAccountControl_ChangeNotificationLevel_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID f522828d-175f-4a80-9c98-b4faef93f4e9 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This configuration will change the notification level for the User 23 | Account Control (UAC). 24 | #> 25 | Configuration UserAccountControl_ChangeNotificationLevel_Config 26 | { 27 | Import-DscResource -Module ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | UserAccountControl 'ChangeNotificationLevel' 32 | { 33 | IsSingleInstance = 'Yes' 34 | NotificationLevel = 'AlwaysNotifyAndAskForCredentials' 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/Examples/Resources/UserAccountControl/2-UserAccountControl_GranularSettings_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 98af759c-cb49-41cb-94ea-c80f3f22bcbb 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | This configuration will change the notification level for the User 23 | Account Control (UAC). 24 | #> 25 | Configuration UserAccountControl_GranularSettings_Config 26 | { 27 | Import-DscResource -Module ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | UserAccountControl 'SetGranularSettings' 32 | { 33 | IsSingleInstance = 'Yes' 34 | FilterAdministratorToken = 0 35 | ConsentPromptBehaviorAdmin = 5 36 | ConsentPromptBehaviorUser = 3 37 | EnableInstallerDetection = 1 38 | ValidateAdminCodeSignatures = 0 39 | EnableLua = 1 40 | PromptOnSecureDesktop = 1 41 | EnableVirtualization = 1 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /source/Examples/Resources/VirtualMemory/1-VirtualMemory_SetVirtualMemory_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 8ea6bdd3-8822-4e6e-9957-d8576a45c55a 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Example script that sets the paging file to reside on 23 | drive C with the custom size 2048MB. 24 | #> 25 | Configuration VirtualMemory_SetVirtualMemory_Config 26 | { 27 | Import-DSCResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | VirtualMemory PagingSettings 32 | { 33 | Type = 'CustomSize' 34 | Drive = 'C' 35 | InitialSize = '2048' 36 | MaximumSize = '2048' 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/Examples/Resources/WindowsCapability/1-WindowsCapability_AddWindowsCapability_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID adade795-9143-4f4a-ae2d-4e31e81029a2 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Example script that adds the Windows Capability XPS.Viewer~~~~0.0.1.0 23 | #> 24 | Configuration WindowsCapability_AddWindowsCapability_Config 25 | { 26 | Import-DSCResource -ModuleName ComputerManagementDsc 27 | 28 | Node localhost 29 | { 30 | WindowsCapability XPSViewer 31 | { 32 | Name = 'XPS.Viewer~~~~0.0.1.0' 33 | Ensure = 'Present' 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /source/Examples/Resources/WindowsCapability/2-WindowsCapability_RemoveWindowsCapability_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 87cc15cc-113a-410a-acad-7333768d648b 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Example script that removes the Windows Capability XPS.Viewer~~~~0.0.1.0 23 | #> 24 | Configuration WindowsCapability_RemoveWindowsCapability_Config 25 | { 26 | Import-DSCResource -ModuleName ComputerManagementDsc 27 | 28 | Node localhost 29 | { 30 | WindowsCapability XPSViewer 31 | { 32 | Name = 'XPS.Viewer~~~~0.0.1.0' 33 | Ensure = 'Absent' 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /source/Examples/Resources/WindowsCapability/3-WindowsCapability_AddWindowsCapabilitywithLogLevelandLogPath_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID c966b525-2764-461e-b48e-b9f479c86a64 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Example script that adds the Windows Capability OpenSSH.Client~~~~0.0.1.0 23 | and set the LogLevel to log Errors only and write the Logfile to Path C:\Temp. 24 | #> 25 | Configuration WindowsCapability_AddWindowsCapabilitywithLogLevelandLogPath_Config 26 | { 27 | Import-DSCResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | WindowsCapability OpenSSHClient 32 | { 33 | Name = 'OpenSSH.Client~~~~0.0.1.0' 34 | Ensure = 'Present' 35 | LogLevel = 'Errors' 36 | LogPath = 'C:\Temp\Logfile.log' 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/Examples/Resources/WindowsCapability/4-WindowsCapability_AddWindowsCapabilitywithLogLevelLogPathandSource_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 369d465e-244c-4789-90a6-6f3387e4c85a 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Example script that adds the Windows Capability OpenSSH.Client~~~~0.0.1.0 23 | and set the LogLevel to log Errors only and write the Logfile to Path C:\Temp. 24 | This also uses the Source path for the installation. 25 | #> 26 | Configuration WindowsCapability_AddWindowsCapabilitywithLogLevelLogPathandSource_Config 27 | { 28 | Import-DSCResource -ModuleName ComputerManagementDsc 29 | 30 | Node localhost 31 | { 32 | WindowsCapability OpenSSHClient 33 | { 34 | Name = 'OpenSSH.Client~~~~0.0.1.0' 35 | Ensure = 'Present' 36 | LogLevel = 'Errors' 37 | LogPath = 'C:\Temp\Logfile.log' 38 | Source = 'F:\Source\FOD\LanguagesAndOptionalFeatures' 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/Examples/Resources/WindowsEventlog/1-WindowsEventLog_SetLogSize_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID f8fb71fd-9f4a-4ae5-93b8-53362752e37d 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Sets the Application log to a maximum size of 4096MB, 23 | the log mode to circular, and ensure it is enabled. 24 | #> 25 | Configuration WindowsEventLog_SetLogSize_Config 26 | { 27 | Import-DSCResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | WindowsEventLog Application 32 | { 33 | LogName = 'Application' 34 | IsEnabled = $true 35 | LogMode = 'Circular' 36 | MaximumSizeInBytes = 4096MB 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/Examples/Resources/WindowsEventlog/10-WindowsEventLog_RegisterEventSourceWithAllFiles_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID cabb6778-8f48-4ce7-ad3d-2cc444bc78e9 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Example script that registers MyEventSource as an event 23 | source with all resource files on the Application log. 24 | #> 25 | Configuration WindowsEventLog_RegisterEventSourceWithAllFiles_Config 26 | { 27 | Import-DSCResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | File MyEventSourceCategoryDll 32 | { 33 | Ensure = 'Present' 34 | Type = 'File' 35 | SourcePath = '\\PULLSERVER\Files\MyEventSource.Category.dll' 36 | DestinationPath = 'C:\Windows\System32\MyEventSource.Category.dll' 37 | } 38 | 39 | File MyEventSourceMessageDll 40 | { 41 | Ensure = 'Present' 42 | Type = 'File' 43 | SourcePath = '\\PULLSERVER\Files\MyEventSource.Message.dll' 44 | DestinationPath = 'C:\Windows\System32\MyEventSource.Message.dll' 45 | } 46 | 47 | File MyEventSourceParameterDll 48 | { 49 | Ensure = 'Present' 50 | Type = 'File' 51 | SourcePath = '\\PULLSERVER\Files\MyEventSource.Parameter.dll' 52 | DestinationPath = 'C:\Windows\System32\MyEventSource.Parameter.dll' 53 | } 54 | 55 | WindowsEventLog Application 56 | { 57 | LogName = 'Application' 58 | RegisteredSource = 'MyEventSource' 59 | CategoryResourceFile = 'C:\Windows\System32\MyEventSource.Category.dll' 60 | MessageResourceFile = 'C:\Windows\System32\MyEventSource.Messages.dll' 61 | ParameterResourceFile = 'C:\Windows\System32\MyEventSource.Parameters.dll' 62 | DependsOn = '[File]MyEventSourceCategoryDll', 63 | '[File]MyEventSourceMessageDll', 64 | '[File]MyEventSourceParameterDll' 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /source/Examples/Resources/WindowsEventlog/2-WindowsEventLog_SetLogMode_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 5e3f845c-58ce-4e46-baaf-2422d30176ca 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Example script that sets the MSPaint Admin event channel 23 | to log mode AutoBackup, a maximum size of 2048MB, log 24 | retention for 10 days, and ensure it is enabled. 25 | #> 26 | Configuration WindowsEventLog_SetLogMode_Config 27 | { 28 | Import-DSCResource -ModuleName ComputerManagementDsc 29 | 30 | Node localhost 31 | { 32 | WindowsEventLog MSPaintAdmin 33 | { 34 | LogName = 'Microsoft-Windows-MSPaint/Admin' 35 | IsEnabled = $true 36 | LogMode = 'AutoBackup' 37 | LogRetentionDays = 10 38 | MaximumSizeInBytes = 2048KB 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/Examples/Resources/WindowsEventlog/3-WindowsEventlog_EnableWindowsEventLog_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID f05286e4-e357-40f8-ba62-e49d4d50eb0f 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Example script that sets the DSC Analytic log 23 | to size maximum size 4096MB, log mode to 'Retain' and 24 | ensures it is enabled. 25 | #> 26 | Configuration WindowsEventLog_EnableWindowsEventLog_Config 27 | { 28 | Import-DSCResource -ModuleName ComputerManagementDsc 29 | 30 | Node localhost 31 | { 32 | WindowsEventLog DscAnalytic 33 | { 34 | LogName = 'Microsoft-Windows-Dsc/Analytic' 35 | IsEnabled = $true 36 | LogMode = 'Retain' 37 | MaximumSizeInBytes = 4096MB 38 | LogFilePath = '%SystemRoot%\System32\Winevt\Logs\Microsoft-Windows-DSC%4Analytic.evtx' 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/Examples/Resources/WindowsEventlog/4-WindowsEventLog_DisableWindowsEventLog_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 1d426e51-df3b-4723-96ac-e7d790744f69 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Example script that disables the DSC Analytic log. 23 | #> 24 | Configuration WindowsEventLog_DisableWindowsEventLog_Config 25 | { 26 | Import-DSCResource -ModuleName ComputerManagementDsc 27 | 28 | Node localhost 29 | { 30 | WindowsEventLog DscAnalytic 31 | { 32 | LogName = 'Microsoft-Windows-Dsc/Analytic' 33 | IsEnabled = $false 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /source/Examples/Resources/WindowsEventlog/5-WindowsEventLog_SetSecurityDescriptor_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 07323d21-39a0-4f62-bed7-7acc943f9234 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Example script that reconfigures the security 23 | descriptor (DACL) of the Application log. 24 | #> 25 | Configuration WindowsEventLog_SetSecurityDescriptor_Config 26 | { 27 | Import-DSCResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | WindowsEventLog Application 32 | { 33 | LogName = 'Application' 34 | SecurityDescriptor = 'O:BAG:SYD:(A;;0x7;;;BA)(A;;0x7;;;SO)(A;;0x3;;;IU)(A;;0x3;;;SU)(A;;0x3;;;S-1-5-3)(A;;0x3;;;S-1-5-33)(A;;0x1;;;S-1-5-32-573)' 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/Examples/Resources/WindowsEventlog/6-WindowsEventLog_RestrictGuestAccess_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID ab5cc60b-b834-49b0-80f4-f73f18bf9199 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Example script that prohibits guests from accessing 23 | the System event log. 24 | #> 25 | Configuration WindowsEventLog_RestrictGuestAccess_Config 26 | { 27 | Import-DSCResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | WindowsEventLog System 32 | { 33 | LogName = 'System' 34 | RestrictGuestAccess = $true 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/Examples/Resources/WindowsEventlog/7-WindowsEventLog_AllowGuestAccess_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 3f7e83d6-f29c-45f1-a305-2addb69fb0f2 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Example script that allows guests to access 23 | the Application event log. 24 | #> 25 | Configuration WindowsEventLog_AllowGuestAccess_Config 26 | { 27 | Import-DSCResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | WindowsEventLog System 32 | { 33 | LogName = 'System' 34 | RestrictGuestAccess = $false 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/Examples/Resources/WindowsEventlog/8-WindowsEventLog_RegisterEventSource_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 857f9f25-082e-4274-9efd-0908f49bb516 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Example script that registers MyEventSource as an event 23 | source on the Application log. 24 | #> 25 | Configuration WindowsEventLog_RegisterEventSource_Config 26 | { 27 | Import-DSCResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | WindowsEventLog Application 32 | { 33 | LogName = 'Application' 34 | RegisteredSource = 'MyEventSource' 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/Examples/Resources/WindowsEventlog/9-WindowsEventLog_RegisterEventSourceWithMessageFile_Config.ps1: -------------------------------------------------------------------------------- 1 | <#PSScriptInfo 2 | .VERSION 1.0.0 3 | .GUID 13b87555-fdf1-4cc7-b033-73074573e0e3 4 | .AUTHOR DSC Community 5 | .COMPANYNAME DSC Community 6 | .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. 7 | .TAGS DSCConfiguration 8 | .LICENSEURI https://github.com/dsccommunity/ComputerManagementDsc/blob/main/LICENSE 9 | .PROJECTURI https://github.com/dsccommunity/ComputerManagementDsc 10 | .ICONURI 11 | .EXTERNALMODULEDEPENDENCIES 12 | .REQUIREDSCRIPTS 13 | .EXTERNALSCRIPTDEPENDENCIES 14 | .RELEASENOTES First version. 15 | .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core 16 | #> 17 | 18 | #Requires -module ComputerManagementDsc 19 | 20 | <# 21 | .DESCRIPTION 22 | Example script that registers MyEventSource as an event 23 | source with a message resource file on the Application log. 24 | #> 25 | Configuration WindowsEventLog_RegisterEventSourceWithMessageFile_Config 26 | { 27 | Import-DSCResource -ModuleName ComputerManagementDsc 28 | 29 | Node localhost 30 | { 31 | File MyEventSourceMessageDll 32 | { 33 | Ensure = 'Present' 34 | Type = 'File' 35 | SourcePath = '\\PULLSERVER\Files\MyEventSource.dll' 36 | DestinationPath = 'C:\Windows\System32\MyEventSource.dll' 37 | } 38 | 39 | WindowsEventLog Application 40 | { 41 | LogName = 'Application' 42 | RegisteredSource = 'MyEventSource' 43 | MessageResourceFile = 'C:\Windows\System32\MyEventSource.dll' 44 | DependsOn = '[File]MyEventSourceMessageDll' 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/Modules/ComputerManagementDsc.Common/en-US/ComputerManagementDsc.Common.strings.psd1: -------------------------------------------------------------------------------- 1 | ConvertFrom-StringData @' 2 | CurrentTimeZoneMessage = Current time zone is set to '{0}'. 3 | GettingTimeZoneMessage = Getting current time zone using '{0}'. 4 | SettingTimeZoneMessage = Setting time zone to '{0}' using '{1}'. 5 | TimeZoneUpdatedMessage = Time zone has been updated to '{0}'. 6 | AddingSetTimeZoneDotNetTypeMessage = Adding .NET Set time zone Type. 7 | UnableToEnumeratingPowerSchemes = Error occurred while enumerating power schemes. Win32 error code: {0} - {1} 8 | UnableToGetPowerSchemeFriendlyName = Error occurred while getting the friendly name of the power scheme with the GUID {0}. Win32 error code: {1} - {2} 9 | FailedToGetActivePowerScheme = Error occurred while getting active power scheme. Win32 error code: {0} - {1} 10 | FailedToSetActivePowerScheme = Error occurred while activating power scheme with the GUID {0}. Win32 error code: {1} - {2} 11 | EnumeratingPowerPlans = Enumerating all available power plans/schemes on the system using native Win32 function 'PowerEnumerate'. 12 | PowerPlanFound = Found power scheme '{0}'. Getting friendly name. 13 | PowerPlanFriendlyNameFound = Friendly name is '{0}'. 14 | AllPowerPlansFound = Enumerating of available power schemes done. 15 | '@ 16 | -------------------------------------------------------------------------------- /source/WikiSource/Home.md: -------------------------------------------------------------------------------- 1 | # Welcome to the ComputerManagementDsc wiki 2 | 3 | *ComputerManagementDsc v#.#.#* 4 | 5 | Here you will find all the information you need to make use of the ComputerManagementDsc 6 | DSC resources, including details of the resources that are available, current 7 | capabilities and known issues, and information to help plan a DSC based 8 | implementation of ComputerManagementDsc. 9 | 10 | Please leave comments, feature requests, and bug reports in then 11 | [issues section](https://github.com/dsccommunity/ComputerManagementDsc/issues) for this module. 12 | 13 | ## Getting started 14 | 15 | To get started download ComputerManagementDsc from the [PowerShell Gallery](http://www.powershellgallery.com/packages/ComputerManagementDsc/) 16 | and then unzip it to one of your PowerShell modules folders 17 | (such as $env:ProgramFiles\WindowsPowerShell\Modules). 18 | 19 | To install from the PowerShell gallery using PowerShellGet (in PowerShell 5.0) 20 | run the following command: 21 | 22 | ```powershell 23 | Find-Module -Name ComputerManagementDsc -Repository PSGallery | Install-Module 24 | ``` 25 | 26 | To confirm installation, run the below command and ensure you see the ComputerManagementDsc 27 | DSC resources available: 28 | 29 | ```powershell 30 | Get-DscResource -Module ComputerManagementDsc 31 | ``` 32 | 33 | ## Change Log 34 | 35 | A full list of changes in each version can be found in the [change log](https://github.com/dsccommunity/ComputerManagementDsc/blob/main/CHANGELOG.md). 36 | -------------------------------------------------------------------------------- /source/en-US/ComputerManagementDsc.strings.psd1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | The localized resource strings in English (en-US) for the 4 | resource ComputerManagementDsc module. This file should only contain 5 | localized strings for private and public functions. 6 | #> 7 | 8 | ConvertFrom-StringData @' 9 | '@ 10 | -------------------------------------------------------------------------------- /source/en-US/PSResourceRepository.strings.psd1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | The localized resource strings in English (en-US) for the 4 | class PSResourceRepository. 5 | #> 6 | 7 | ConvertFrom-StringData -StringData @' 8 | GetTargetResourceMessage = Return the current state of the repository '{0}'. 9 | RepositoryNotFound = The repository '{0}' was not found. 10 | RemoveExistingRepository = Removing the repository '{0}'. 11 | ProxyCredentialPassedWithoutProxyUri = Proxy Credential passed without Proxy Uri. 12 | RegisterRepository = Registering repository '{0}' with SourceLocation '{1}'. 13 | UpdateRepository = Updating repository '{0}' with SourceLocation '{1}'. 14 | RegisterDefaultRepository = Registering default repository '{0}' with -Default parameter. 15 | SourceLocationRequiredForRegistration = SourceLocation is a required parameter to register a repository. 16 | NoDefaultSettingsPSGallery = The parameter Default must be set to True for a repository named PSGallery. 17 | DefaultSettingsNoPSGallery = The parameter Default may only be used with repositories named PSGallery. 18 | '@ 19 | -------------------------------------------------------------------------------- /source/en-US/about_ComputerManagementDsc.help.txt: -------------------------------------------------------------------------------- 1 | TOPIC 2 | about_ComputerManagementDsc 3 | 4 | SHORT DESCRIPTION 5 | DSC resources for configuration of a Windows computer. These DSC resources 6 | allow you to perform computer management tasks, such as renaming the computer, 7 | joining a domain and scheduling tasks as well as configuring items such as 8 | virtual memory, event logs, time zones and power settings. 9 | 10 | LONG DESCRIPTION 11 | This module contains DSC resources for configuration of a Windows computer. 12 | These DSC resources allow you to perform computer management tasks, such as 13 | renaming the computer, joining a domain and scheduling tasks as well as 14 | configuring items such as virtual memory, event logs, time zones and power 15 | settings. 16 | 17 | EXAMPLES 18 | PS C:\> Get-DscResource -Module ComputerManagementDsc 19 | 20 | NOTE: 21 | Thank you to the DSC Community contributors who contributed to this module by 22 | writing code, sharing opinions, and provided feedback. 23 | 24 | TROUBLESHOOTING NOTE: 25 | Go to the Github repository for read about issues, submit a new issue, and read 26 | about new releases. https://github.com/dsccommunity/ComputerManagementDsc 27 | 28 | SEE ALSO 29 | - https://github.com/dsccommunity/ComputerManagementDsc 30 | 31 | KEYWORDS 32 | DSC, DscResource, Computer, OfflineDomainJoin, PendingReboot, PowerPlan, 33 | PowerShellExecutionPolicy, RemoteDesktopAdmin, ScheduledTask, SmbServerConfiguration 34 | SmbShare, SystemLocale, SystemProtection, SystemRestorePoint, TimeZone, 35 | VirtualMemory, WindowsEventLog, WindowsCapability 36 | -------------------------------------------------------------------------------- /source/prefix.ps1: -------------------------------------------------------------------------------- 1 | using module .\Modules\DscResource.Base 2 | 3 | $script:dscResourceCommonModulePath = Join-Path -Path $PSScriptRoot -ChildPath 'Modules/DscResource.Common' 4 | Import-Module -Name $script:dscResourceCommonModulePath 5 | 6 | $script:computerManagementDscCommonModulePath = Join-Path -Path $PSScriptRoot -ChildPath 'Modules/ComputerManagementDsc.Common' 7 | Import-Module -Name $script:computerManagementDscCommonModulePath 8 | 9 | $script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US' 10 | -------------------------------------------------------------------------------- /tests/Integration/DSC_IEEnhancedSecurityConfiguration.Config.ps1: -------------------------------------------------------------------------------- 1 | # Integration Test Config Template Version: 1.0.0 2 | configuration DSC_IEEnhancedSecurityConfiguration_Config 3 | { 4 | Import-DscResource -ModuleName ComputerManagementDsc 5 | 6 | node $AllNodes.NodeName 7 | { 8 | IEEnhancedSecurityConfiguration 'AdministratorsSetting' 9 | { 10 | Role = $Node.Role 11 | Enabled = $Node.Enabled 12 | SuppressRestart = $true 13 | } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /tests/Integration/DSC_PendingReboot.config.ps1: -------------------------------------------------------------------------------- 1 | # Integration Test Config Template Version: 1.0.0 2 | Configuration DSC_PendingReboot_config 3 | { 4 | Import-DscResource -ModuleName ComputerManagementDsc 5 | 6 | node $AllNodes.NodeName 7 | { 8 | PendingReboot TestReboot 9 | { 10 | Name = $Node.RebootName 11 | SkipComponentBasedServicing = $Node.SkipComponentBasedServicing 12 | SkipWindowsUpdate = $Node.SkipWindowsUpdate 13 | SkipPendingFileRename = $Node.SkipPendingFileRename 14 | SkipPendingComputerRename = $Node.SkipPendingComputerRename 15 | SkipCcmClientSDK = $Node.SkipCcmClientSDK 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/Integration/DSC_PowerShellExecutionPolicy.config.ps1: -------------------------------------------------------------------------------- 1 | # Integration Test Config Template Version: 1.0.0 2 | Configuration DSC_PowerShellExecutionPolicy_config 3 | { 4 | Import-DscResource -ModuleName ComputerManagementDsc 5 | 6 | node 'localhost' 7 | { 8 | PowerShellExecutionPolicy Integration_Test 9 | { 10 | ExecutionPolicy = 'RemoteSigned' 11 | ExecutionPolicyScope = 'LocalMachine' 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/Integration/DSC_RemoteDesktopAdmin.config.ps1: -------------------------------------------------------------------------------- 1 | Configuration setToDenied 2 | { 3 | Import-DscResource -ModuleName ComputerManagementDsc 4 | 5 | node 'localhost' { 6 | RemoteDesktopAdmin RemoteDesktopAdmin 7 | { 8 | IsSingleInstance = 'Yes' 9 | Ensure = 'Absent' 10 | } 11 | } 12 | } 13 | 14 | Configuration setToAllowed 15 | { 16 | Import-DscResource -ModuleName ComputerManagementDsc 17 | 18 | node 'localhost' { 19 | RemoteDesktopAdmin RemoteDesktopAdmin 20 | { 21 | IsSingleInstance = 'Yes' 22 | Ensure = 'Present' 23 | } 24 | } 25 | } 26 | 27 | Configuration setToAllowedSecure 28 | { 29 | Import-DscResource -ModuleName ComputerManagementDsc 30 | 31 | node 'localhost' { 32 | RemoteDesktopAdmin RemoteDesktopAdmin 33 | { 34 | IsSingleInstance = 'Yes' 35 | Ensure = 'Present' 36 | UserAuthentication = 'Secure' 37 | } 38 | } 39 | } 40 | 41 | Configuration setToAllowedNonSecure 42 | { 43 | Import-DscResource -ModuleName ComputerManagementDsc 44 | 45 | node 'localhost' { 46 | RemoteDesktopAdmin RemoteDesktopAdmin 47 | { 48 | IsSingleInstance = 'Yes' 49 | Ensure = 'Present' 50 | UserAuthentication = 'NonSecure' 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /tests/Integration/DSC_SmbServerConfiguration.config.ps1: -------------------------------------------------------------------------------- 1 | # Integration Test Config Template Version: 1.0.0 2 | Configuration DSC_SmbServerConfiguration_config 3 | { 4 | Import-DscResource -ModuleName ComputerManagementDsc 5 | 6 | node $AllNodes.NodeName { 7 | SmbServerConfiguration SmbServer 8 | { 9 | IsSingleInstance = $node.IsSingleInstance 10 | AnnounceComment = $node.AnnounceComment 11 | AnnounceServer = $node.AnnounceServer 12 | AsynchronousCredits = $node.AsynchronousCredits 13 | AuditSmb1Access = $node.AuditSmb1Access 14 | AutoDisconnectTimeout = $node.AutoDisconnectTimeout 15 | AutoShareServer = $node.AutoShareServer 16 | AutoShareWorkstation = $node.AutoShareWorkstation 17 | CachedOpenLimit = $node.CachedOpenLimit 18 | DurableHandleV2TimeoutInSeconds = $node.DurableHandleV2TimeoutInSeconds 19 | EnableAuthenticateUserSharing = $node.EnableAuthenticateUserSharing 20 | EnableDownlevelTimewarp = $node.EnableDownlevelTimewarp 21 | EnableForcedLogoff = $node.EnableForcedLogoff 22 | EnableLeasing = $node.EnableLeasing 23 | EnableMultiChannel = $node.EnableMultiChannel 24 | EnableOplocks = $node.EnableOplocks 25 | EnableSecuritySignature = $node.EnableSecuritySignature 26 | EnableSMB1Protocol = $node.EnableSMB1Protocol 27 | EnableSMB2Protocol = $node.EnableSMB2Protocol 28 | EnableStrictNameChecking = $node.EnableStrictNameChecking 29 | EncryptData = $node.EncryptData 30 | IrpStackSize = $node.IrpStackSize 31 | KeepAliveTime = $node.KeepAliveTime 32 | MaxChannelPerSession = $node.MaxChannelPerSession 33 | MaxMpxCount = $node.MaxMpxCount 34 | MaxSessionPerConnection = $node.MaxSessionPerConnection 35 | MaxThreadsPerQueue = $node.MaxThreadsPerQueue 36 | MaxWorkItems = $node.MaxWorkItems 37 | NullSessionPipes = $node.NullSessionPipes 38 | NullSessionShares = $node.NullSessionShares 39 | OplockBreakWait = $node.OplockBreakWait 40 | PendingClientTimeoutInSeconds = $node.PendingClientTimeoutInSeconds 41 | RejectUnencryptedAccess = $node.RejectUnencryptedAccess 42 | RequireSecuritySignature = $node.RequireSecuritySignature 43 | ServerHidden = $node.ServerHidden 44 | Smb2CreditsMax = $node.Smb2CreditsMax 45 | Smb2CreditsMin = $node.Smb2CreditsMin 46 | SmbServerNameHardeningLevel = $node.SmbServerNameHardeningLevel 47 | TreatHostAsStableStorage = $node.TreatHostAsStableStorage 48 | ValidateAliasNotCircular = $node.ValidateAliasNotCircular 49 | ValidateShareScope = $node.ValidateShareScope 50 | ValidateShareScopeNotAliased = $node.ValidateShareScopeNotAliased 51 | ValidateTargetName = $node.ValidateTargetName 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tests/Integration/DSC_SystemLocale.config.ps1: -------------------------------------------------------------------------------- 1 | Configuration DSC_SystemLocale_Config { 2 | Import-DscResource -ModuleName ComputerManagementDsc 3 | 4 | node localhost { 5 | SystemLocale Integration_Test { 6 | SystemLocale = $Node.SystemLocale 7 | IsSingleInstance = $Node.IsSingleInstance 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/Integration/DSC_TimeZone.config.ps1: -------------------------------------------------------------------------------- 1 | Configuration DSC_TimeZone_Config { 2 | Import-DscResource -ModuleName ComputerManagementDsc 3 | 4 | node localhost 5 | { 6 | TimeZone Integration_Test 7 | { 8 | TimeZone = $Node.TimeZone 9 | IsSingleInstance = $Node.IsSingleInstance 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tests/Integration/DSC_UserAccountControl.Config.ps1: -------------------------------------------------------------------------------- 1 | configuration DSC_UserAccountControl_Config 2 | { 3 | Import-DscResource -ModuleName ComputerManagementDsc 4 | 5 | node $AllNodes.NodeName 6 | { 7 | UserAccountControl 'SetGranularSettings' 8 | { 9 | IsSingleInstance = 'Yes' 10 | ConsentPromptBehaviorUser = $Node.ConsentPromptBehaviorUser 11 | EnableInstallerDetection = $Node.EnableInstallerDetection 12 | SuppressRestart = $true 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/Integration/DSC_VirtualMemory.config.ps1: -------------------------------------------------------------------------------- 1 | Configuration setToAuto 2 | { 3 | Import-DscResource -ModuleName ComputerManagementDsc 4 | node 'localhost' 5 | { 6 | VirtualMemory vMem 7 | { 8 | Type = 'AutoManagePagingFile' 9 | Drive = 'C' 10 | } 11 | } 12 | } 13 | 14 | Configuration setToCustom 15 | { 16 | Import-DscResource -ModuleName ComputerManagementDsc 17 | 18 | node 'localhost' 19 | { 20 | VirtualMemory vMem 21 | { 22 | Type = 'CustomSize' 23 | Drive = 'C' 24 | InitialSize = 128 25 | MaximumSize = 1024 26 | } 27 | } 28 | } 29 | 30 | Configuration setToSystemManaged 31 | { 32 | Import-DscResource -ModuleName ComputerManagementDsc 33 | 34 | node 'localhost' 35 | { 36 | VirtualMemory vMem 37 | { 38 | Type = 'SystemManagedSize' 39 | Drive = 'C' 40 | } 41 | } 42 | } 43 | 44 | Configuration setToNone 45 | { 46 | Import-DscResource -ModuleName ComputerManagementDsc 47 | 48 | node 'localhost' 49 | { 50 | VirtualMemory vMem 51 | { 52 | Type = 'NoPagingFile' 53 | Drive = 'C' 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /tests/Integration/DSC_WindowsCapability.config.ps1: -------------------------------------------------------------------------------- 1 | # Integration Test Config Template Version: 1.0.0 2 | Configuration DSC_WindowsCapability_Config 3 | { 4 | Import-DscResource -ModuleName ComputerManagementDsc 5 | 6 | node $AllNodes.NodeName 7 | { 8 | WindowsCapability TestInstallation 9 | { 10 | Name = $Node.Name 11 | LogLevel = $Node.LogLevel 12 | LogPath = $Node.LogPath 13 | Ensure = $Node.Ensure 14 | Source = $Node.Source 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/TestHelpers/CommonTestHelper.psm1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Returns an invalid argument exception object 4 | 5 | .PARAMETER Message 6 | The message explaining why this error is being thrown 7 | 8 | .PARAMETER ArgumentName 9 | The name of the invalid argument that is causing this error to be thrown 10 | #> 11 | function Get-InvalidArgumentRecord 12 | { 13 | [CmdletBinding()] 14 | param 15 | ( 16 | [Parameter(Mandatory = $true)] 17 | [ValidateNotNullOrEmpty()] 18 | [String] 19 | $Message, 20 | 21 | [Parameter(Mandatory = $true)] 22 | [ValidateNotNullOrEmpty()] 23 | [String] 24 | $ArgumentName 25 | ) 26 | 27 | $argumentException = New-Object -TypeName 'ArgumentException' -ArgumentList @( $Message, 28 | $ArgumentName ) 29 | $newObjectParams = @{ 30 | TypeName = 'System.Management.Automation.ErrorRecord' 31 | ArgumentList = @( $argumentException, $ArgumentName, 'InvalidArgument', $null ) 32 | } 33 | return New-Object @newObjectParams 34 | } 35 | 36 | <# 37 | .SYNOPSIS 38 | Test if the source files are available for Windows Capability. 39 | If the source files are not available Get-WindowsCapability 40 | will throw an exception. 41 | #> 42 | function Test-WindowsCapabilitySourceAvailable 43 | { 44 | [CmdletBinding()] 45 | [OutputType([System.Boolean])] 46 | param () 47 | 48 | $sourceAvailable = $true 49 | 50 | try 51 | { 52 | Get-WindowsCapability -Online -ErrorAction Stop 53 | } 54 | catch 55 | { 56 | $sourceAvailable = $false 57 | } 58 | 59 | return $sourceAvailable 60 | } 61 | 62 | <# 63 | .SYNOPSIS 64 | Resets the DSC LCM by performing the following functions: 65 | 1. Cancel any currently executing DSC LCM operations 66 | 2. Remove any DSC configurations that: 67 | - are currently applied 68 | - are pending application 69 | - have been previously applied 70 | The purpose of this function is to ensure the DSC LCM is in a known 71 | and idle state before an integration test is performed that will 72 | apply a configuration. 73 | This is to prevent an integration test from being performed but failing 74 | because the DSC LCM is applying a previous configuration. 75 | This function should be called after each Describe block in an integration 76 | test to ensure the DSC LCM is reset before another test DSC configuration 77 | is applied. 78 | .EXAMPLE 79 | PS C:\> Reset-DscLcm 80 | This command will reset the DSC LCM and clear out any DSC configurations. 81 | #> 82 | function Reset-DscLcm 83 | { 84 | [CmdletBinding()] 85 | param () 86 | 87 | Write-Verbose -Message 'Resetting DSC LCM.' 88 | 89 | Stop-DscConfiguration -Force -ErrorAction SilentlyContinue 90 | Remove-DscConfigurationDocument -Stage Current -Force 91 | Remove-DscConfigurationDocument -Stage Pending -Force 92 | Remove-DscConfigurationDocument -Stage Previous -Force 93 | } 94 | --------------------------------------------------------------------------------