├── CODEOWNERS.md
├── .idea
├── .gitignore
├── misc.xml
├── vcs.xml
├── modules.xml
└── xoap-powershell-dsc-configurations.iml
├── scripts
├── unblock-files.ps1
└── clean-modules.ps1
├── .github
├── reviewers.yml
├── ISSUE_TEMPLATE
│ ├── config.yml
│ └── General.md
├── workflows
│ ├── commit-message-validator.yaml
│ └── megalinter.yaml
├── dependabot.yml
└── labeler.yml
├── .markdownlint.json
├── Microsoft_Examples
├── Microsoft365DSC
│ ├── readme.md
│ ├── TeamsPstnUsage
│ │ └── 1-AddNewPstnUsage.ps1
│ ├── TeamsGuestCallingConfiguration
│ │ └── 1-ConfigureTeamsGuestCalling.ps1
│ ├── PlannerPlan
│ │ └── 1-NewPlannerPlan.ps1
│ ├── IntuneAppConfigurationPolicy
│ │ ├── 1-NewAppConfigurationPolicy.ps1
│ │ └── 1-RemoveAppConfigurationPolicy.ps1
│ ├── IntuneDeviceCategory
│ │ └── 1-NewDeviceCategory.ps1
│ ├── PlannerBucket
│ │ └── 1-NewPlannerBucket.ps1
│ ├── IntuneDeviceCompliancePolicyAndroid
│ │ └── 2-RemoveDeviceCompliancePolicyAndroid.ps1
│ ├── SCFilePlanPropertySubCategory
│ │ └── 1-AddingNewFilePlanPropertySubCategory.ps1
│ ├── IntuneDeviceCompliancePolicyiOs
│ │ └── 2-RemoveDeviceCompliancePolicyiOs.ps1.ps1
│ ├── SPOTenantCdnEnabled
│ │ └── 1-ConfigureCDN.ps1
│ ├── IntuneDeviceCompliancePolicyMacOS
│ │ └── 2-RemoveDeviceCompliancePolicyMacOS.ps1
│ ├── EXOAcceptedDomain
│ │ └── 1-ConfigureAcceptedDomain.ps1
│ ├── O365OrgCustomizationSetting
│ │ └── 1-EnableCustomizationSetting.ps1
│ ├── SPOSiteAuditSettings
│ │ └── 1-ConfigureSiteAuditSettings.ps1
│ ├── IntuneDeviceCompliancePolicyWindows10
│ │ └── 2-RemoveDeviceCompliancePolicyWindows10.ps1
│ ├── PPPowerAppsEnvironment
│ │ └── 1-NewPowerAppsEnvironment.ps1
│ ├── SCFilePlanPropertyCategory
│ │ └── 1-AddingNewFilePlanPropertyCategory.ps1
│ ├── TeamsUpgradePolicy
│ │ └── 1-AssignUsersToTeamsUpgradePolicy.ps1
│ ├── SCFilePlanPropertyAuthority
│ │ └── 1-AddingNewFilePlanPropertyCategory.ps1
│ ├── SCRetentionEventType
│ │ └── 1-AddingNewRetentionEventType.ps1
│ ├── TeamsUser
│ │ └── 1-AddUserToTeam.ps1
│ ├── IntuneDeviceCompliancePolicyAndroidDeviceOwner
│ │ └── 2-RemoveDeviceCompliancePolicyAndroidDeviceOwner.ps1
│ ├── SCFilePlanPropertyDepartment
│ │ └── 1-AddingNewFilePlanPropertyDepartment.ps1
│ ├── IntuneDeviceCompliancePolicyAndroidWorkProfile
│ │ └── 2-RemoveDeviceCompliancePolicyAndroidWorkProfile.ps1
│ ├── SCFilePlanPropertyReferenceId
│ │ └── 1-AddingNewFilePlanPropertyReferenceId.ps1
│ ├── EXOAvailabilityConfig
│ │ └── 1-ConfigureAvailabilityConfig.ps1
│ ├── TeamsUpgradeConfiguration
│ │ └── 1-ConfigureTeamsUpgradeConfiguration.ps1
│ ├── SPOHomeSite
│ │ └── 1-ConfigureSPOHomeSite.ps1
│ ├── TeamsVoiceRoutingPolicy
│ │ └── 1-AddNewVoiceRoutingPolicy.ps1
│ ├── SPOPropertyBag
│ │ └── 1-AddNewPropertyBagKey.ps1
│ ├── IntuneDeviceEnrollmentLimitRestriction
│ │ └── 1-New Device Enrollment Limit Restriction.ps1
│ ├── PlannerTask
│ │ └── 1-NewPlannerTask.ps1
│ ├── O365AdminAuditLogConfig
│ │ └── 1-ConfigureAuditLog.ps1
│ ├── SCComplianceCase
│ │ └── 1-AddingNewComplianceCase.ps1
│ ├── TeamsFederationConfiguration
│ │ └── 1-ConfigureTeamsFederation.ps1
│ ├── EXOPerimeterConfiguration
│ │ └── 1-ConfigurePerimeterConfiguration.ps1
│ ├── SCSupervisoryReviewPolicy
│ │ └── 1-AddingNewSupervisoryReviewPolicy.ps1
│ ├── SPOBrowserIdleSignout
│ │ └── 1-ConfigureSPOSPOBrowserIdleSignout.ps1
│ ├── SPOSiteDesignRights
│ │ └── 1-AssignDesignRights.ps1
│ ├── TeamsGuestMeetingConfiguration
│ │ └── 1-ConfigureTeamsGuestMeeting.ps1
│ ├── SPOSearchResultSource
│ │ └── 1-CreateNewResultSource.ps1
│ ├── SCFilePlanPropertyCitation
│ │ └── 1-AddingNewCitation.ps1
│ └── EXOManagementRole
│ │ └── 1-ConfigureManagementRole.ps1
├── SharePointDsc
│ └── Resources
│ │ ├── readme.md
│ │ ├── SPConfigWizard
│ │ ├── 1-RunConfigWizard.ps1
│ │ └── 2-RunConfigWizardInWindow.ps1
│ │ ├── SPProjectServerLicense
│ │ ├── 2-DisableProjectServer.ps1
│ │ └── 1-EnableProjectServer.ps1
│ │ ├── SPFarmPropertyBag
│ │ ├── 1-RemoveFarmPropertyBag.ps1
│ │ └── 1-AddFarmPropertyBag.ps1
│ │ ├── SPProjectServerGroup
│ │ ├── 2-ADGroup.ps1
│ │ └── 1-SpecificMembers.ps1
│ │ ├── SPProjectServerADResourcePoolSync
│ │ ├── 2-DisableSync.ps1
│ │ └── 1-EnableSync.ps1
│ │ ├── SPProjectServerWssSettings
│ │ └── 1-Example.ps1
│ │ ├── SPAppCatalog
│ │ └── 1-SetSiteAsAppCatalog.ps1
│ │ ├── SPProjectServerPermissionMode
│ │ ├── 1-SPMode.ps1
│ │ └── 2-PSMode.ps1
│ │ ├── SPAppDomain
│ │ └── 1-SetAppDomainDetails.ps1
│ │ ├── SPSitePropertyBag
│ │ ├── 2-RemoveWebAppPropertyBag.ps1
│ │ └── 1-AddWebAppPropertyBag.ps1
│ │ ├── SPWordAutomationServiceApp
│ │ └── 2-RemoveServiceApp.ps1
│ │ ├── SPAuthenticationRealm
│ │ └── 1-Example.ps1
│ │ ├── SPWebAppPropertyBag
│ │ ├── 2-RemoveWebAppPropertyBag.ps1
│ │ └── 1-AddWebAppPropertyBag.ps1
│ │ ├── SPMinRoleCompliance
│ │ └── 1-EnsureCompliance.ps1
│ │ ├── SPPowerPointAutomationServiceApp
│ │ └── 2-RemoveServiceApp.ps1
│ │ ├── SPWebAppProxyGroup
│ │ └── 1-Example.ps1
│ │ ├── SPProjectServerAdditionalSettings
│ │ └── 1-Example.ps1
│ │ ├── SPAppStoreSettings
│ │ ├── 1-EnableSharePointAppStore.ps1
│ │ ├── 2-EnableAppStores.ps1
│ │ └── 3-DisableAppStores.ps1
│ │ ├── SPIrmSettings
│ │ └── 1-ApplyIRMSConfig.ps1
│ │ ├── SPShellAdmins
│ │ └── 1-FarmAdmins.ps1
│ │ ├── SPWebAppPermissions
│ │ └── 2-AllPermissions.ps1
│ │ ├── SPVisioServiceApp
│ │ └── 1-NewServiceApp.ps1
│ │ ├── SPExcelServiceApp
│ │ └── 1-CreateServiceApp.ps1
│ │ ├── SPSelfServiceSiteCreation
│ │ └── 3-DisableSelfServiceSiteCreation.ps1
│ │ ├── SPInstallLanguagePack
│ │ └── 1-InstallLanguagePack.ps1
│ │ ├── SPStateServiceApp
│ │ └── 1-Example.ps1
│ │ ├── SPDatabaseAAG
│ │ ├── 3-RemoveDBfromAAG.ps1
│ │ ├── 1-AddDBtoAAG.ps1
│ │ └── 2-AddMultipleDBstoAAG.ps1
│ │ ├── SPOfficeOnlineServerBinding
│ │ ├── 1-AddBinding.ps1
│ │ └── 2-RemoveBinding.ps1
│ │ ├── SPServiceInstance
│ │ ├── 1-StartService.ps1
│ │ └── 2-StopService.ps1
│ │ ├── SPSessionStateService
│ │ └── 1-Example.ps1
│ │ ├── SPPerformancePointServiceApp
│ │ └── 1-NewServiceApp.ps1
│ │ ├── SPAccess2010ServiceApp
│ │ └── 1-CreateServiceApp.ps1
│ │ ├── SPProjectServerServiceApp
│ │ └── 1-NewServiceApp.ps1
│ │ ├── SPServiceAppPool
│ │ └── 1-Example.ps1
│ │ ├── SPWorkflowService
│ │ └── 1-RegisterWorkflowService.ps1
│ │ ├── SPAntivirusSettings
│ │ └── 1-SetAntivirusConfig.ps1
│ │ ├── SPFarmAdministrators
│ │ └── 1-SetSpecificAdmins.ps1
│ │ ├── SPQuotaTemplate
│ │ └── 1-Example.ps1
│ │ ├── SPRemoteFarmTrust
│ │ └── 1-Example.ps1
│ │ ├── SPSearchServiceApp
│ │ └── 1-NewServiceApp.ps1
│ │ ├── SPIncomingEmailSettings
│ │ └── 1-EnableAutomaticMode.ps1
│ │ ├── SPInstallPrereqs
│ │ └── 1-OnlineInstall.ps1
│ │ ├── SPPublishServiceApplication
│ │ ├── 2-UnpublishServiceApplication.ps1
│ │ └── 1-PublishServiceApplication.ps1
│ │ ├── SPTrustedRootAuthority
│ │ ├── 2-AddRootAuthorityCertInFilePath.ps1
│ │ ├── 3-RemoveRootAuthority.ps1
│ │ └── 1-AddRootAuthorityCertInCertStore.ps1
│ │ ├── SPWebAppBlockedFileTypes
│ │ └── 2-SpecificList.ps1
│ │ ├── SPProjectServerTimesheetSettings
│ │ └── 1-Example.ps1
│ │ ├── SPFeature
│ │ └── 1-EnableFeature.ps1
│ │ ├── SPInstall
│ │ └── 1-InstallToDefaultPath.ps1
│ │ ├── SPManagedPath
│ │ ├── 2-WildcardPath.ps1
│ │ └── 1-ExplicitPath.ps1
│ │ ├── SPSiteUrl
│ │ └── 1-Example.ps1
│ │ ├── SPWebApplicationAppDomain
│ │ └── 1-Example.ps1
│ │ ├── SPSearchCrawlerImpactRule
│ │ ├── 2 - WaitTime
│ │ └── 1 - RequestLimit
│ │ ├── SPServiceIdentity
│ │ └── 1-Example.ps1
│ │ ├── SPAccessServiceApp
│ │ └── 1-CreateServiceApp.ps1
│ │ ├── SPWorkManagementServiceApp
│ │ └── 1-Example.ps1
│ │ ├── SPSearchFileType
│ │ ├── 1-EnsureFileType.ps1
│ │ └── 2-DisableFileType.ps1
│ │ ├── SPHealthAnalyzerRuleState
│ │ └── 1-DisableHealthRule.ps1
│ │ ├── SPProjectServerUserSyncSettings
│ │ └── 1-Example.ps1
│ │ ├── SPSearchIndexPartition
│ │ └── 1-Example.ps1
│ │ └── SPWebAppSuiteBar
│ │ └── 2-ApplySuiteBarBranding2013.ps1
├── AzureConnectedMachineDsc
│ ├── AzureConnectedMachineAgent.ConfigurationData.ps1
│ └── AzureConnectedMachineAgentConfig.ps1
├── xExchange
│ ├── ConfigureDatabases-FromCalculator
│ │ └── CalculatorAndScripts
│ │ │ └── E2013Calcv7.6 - Example.xlsm
│ ├── EndToEndExample
│ │ └── Calculators
│ │ │ └── Lab
│ │ │ └── Servers.csv
│ └── WaitForADPrep
│ │ └── WaitForADPrep.ps1
├── ConfigMgrCBDsc
│ ├── CMClientPushSettings
│ │ ├── CMClientPushSettings_Disabled.ps1
│ │ └── CMClientPushSettings_Include.ps1
│ ├── CMUserDiscovery
│ │ ├── CMUserDiscovery_Disabled.ps1
│ │ ├── CMUserDiscovery_ScheduleNone.ps1
│ │ └── CMUserDiscovery_Enabled.ps1
│ ├── CMGroupDiscovery
│ │ └── GroupDiscovery_Disabled.ps1
│ ├── CMSystemDiscovery
│ │ └── CMSystemDiscovery_Disabled.ps1
│ ├── CMForestDiscovery
│ │ ├── ForestDiscovery_Disabled.ps1
│ │ └── ForestDiscovery_Enabled.ps1
│ ├── CMNetworkDiscovery
│ │ ├── CMNetworkDiscovery_Enabled.ps1
│ │ └── CMNetworkDiscovery_Disabled.ps1
│ ├── CMHeartbeatDiscovery
│ │ ├── CMHeartbeatDiscovery_Disabled.ps1
│ │ └── CMHeartbeatDiscovery_Enabled.ps1
│ ├── CMAccounts
│ │ └── CMAccounts_Absent.ps1
│ ├── CMEmailNotificationComponent
│ │ ├── CMEmailNotificationComponent_Absent.ps1
│ │ └── CMEmailNotificationComponent_Present.ps1
│ ├── CMAdministrativeUser
│ │ └── CMAdministrativeUser_Absent.ps1
│ ├── CMFileReplication
│ │ └── CMFileReplication_Absent.ps1
│ ├── CMSiteMaintenance
│ │ ├── CMSiteMaintenance_Disabled.ps1
│ │ ├── CMSiteMaintenance_UpdateAppCatTablesTask_Enabled.ps1
│ │ ├── CMSiteMaintenance_BackupTask_Enabled.ps1
│ │ ├── CMSiteMaintenance_SummaryTask_Enabled.ps1
│ │ └── CMSiteMaintenance_MaintenanceTask_Enabled.ps1
│ ├── CMBoundaryGroups
│ │ └── CMBoundaryGroups_Absent.ps1
│ ├── CMSecurityScopes
│ │ ├── CMSecurityScopes_Absent.ps1
│ │ └── CMSecurityScopes_Present.ps1
│ ├── CMManagementPoint
│ │ ├── CMManagementPoint_Absent.ps1
│ │ └── CMManagementPoint_Present.ps1
│ ├── CMSecurityRoles
│ │ └── CMSecurityRoles_Absent.ps1
│ ├── CMDistributionPoint
│ │ └── CMDistributionPoint_Absent.ps1
│ ├── CMSiteSystemServer
│ │ └── CMSiteSystemServer_Absent.ps1
│ ├── CMCollections
│ │ └── Collection_Absent.ps1
│ ├── CMDistributionGroup
│ │ └── CMDistributionGroup_Absent.ps1
│ ├── CMFallbackStatusPoint
│ │ ├── CMFallbackStatusPoint_Absent.ps1
│ │ └── CMFallbackStatusPoint_Present.ps1
│ ├── CMPxeDistributionPoint
│ │ └── CMPxeDistributionPoint_Disabled.ps1
│ ├── CMSoftwareUpdatePoint
│ │ ├── CMSoftwareUpdatePoint_Absent.ps1
│ │ └── CMSoftwareUpdatePoint_Present.ps1
│ ├── CMPullDistributionPoint
│ │ └── CMPullDistributionPoint_Disabled.ps1
│ ├── CMReportingServicePoint
│ │ ├── CMReportingServicePoint_Absent.ps1
│ │ └── CMReportingServicePoint_Present.ps1
│ ├── CMMaintenanceWindows
│ │ └── CMMaintenanceWindows_Absent.ps1
│ ├── CMServiceConnectionPoint
│ │ ├── CMServiceConnectionPoint_Absent.ps1
│ │ └── CMServiceConnectionPoint_Present.ps1
│ ├── CMCollectionMembershipEvaluationComponent
│ │ └── CMCollectionMembershipEvaluationComponent_Example.ps1
│ ├── CMBoundaries
│ │ └── CMBoundaries_Absent.ps1
│ ├── CMAssetIntelligencePoint
│ │ ├── CMAssetIntelligencePoint_Absent.ps1
│ │ └── CMAssetIntelligencePoint_Present.ps1
│ ├── CMSoftwareUpdatePointComponent
│ │ └── CMSoftwareUpdatePointComponent_ChildSite.ps1
│ ├── CMClientStatusSettings
│ │ └── CMClientStatusSettings.ps1
│ ├── CMClientSettingsDelivery
│ │ └── CMClientSettingsDelivery.ps1
│ ├── CMClientSettingsMetered
│ │ └── CMClientSettingsMetered.ps1
│ ├── CMClientSettingsStateMessaging
│ │ └── CMClientSettingsStateMessaging.ps1
│ └── xSccmInstall
│ │ └── SccmInstall.ps1
├── PSDscResources
│ ├── Sample_ServiceSet_StartServices.ps1
│ ├── Sample_Service_DeleteService.ps1
│ ├── Sample_User_CreateUser.ps1
│ ├── Sample_ProcessSet_Start.ps1
│ ├── Sample_ServiceSet_BuiltInAccount.ps1
│ ├── Sample_WindowsOptionalFeatureSet_Disable.ps1
│ ├── Sample_RegistryResource_RemoveValue.ps1
│ ├── Sample_RegistryResource_AddKey.ps1
│ ├── Sample_RegistryResource_RemoveKey.ps1
│ ├── Sample_WindowsProcess_Start.ps1
│ ├── Sample_Environment_Remove.ps1
│ ├── Sample_Group_RemoveMembers.ps1
│ ├── Sample_WindowsProcess_Stop.ps1
│ ├── Sample_WindowsFeatureSet_Install.ps1
│ ├── Sample_WindowsOptionalFeatureSet_Enable.ps1
│ ├── Sample_ProcessSet_Stop.ps1
│ ├── Sample_WindowsFeatureSet_Uninstall.ps1
│ ├── Sample_Environment_CreateNonPathVariable.ps1
│ ├── Sample_Group_SetMembers.ps1
│ └── Sample_GroupSet_AddMembers.ps1
├── OfficeOnlineServerDsc
│ └── Resources
│ │ ├── OfficeOnlineServerInstall
│ │ └── 1-InstallBinaries.ps1
│ │ ├── OfficeOnlineServerFarm
│ │ └── 1-NewFarm.ps1
│ │ ├── OfficeOnlineServerInstallLanguagePack
│ │ └── 1-InstallLanguagePack.ps1
│ │ └── OfficeOnlineServerMachine
│ │ └── 1-JoinFarm.ps1
├── HyperVDsc
│ ├── VMNetworkAdapter
│ │ ├── 1-ManagementOS.ps1
│ │ ├── 6-VMVlanTagging.ps1
│ │ ├── 5-VMStaticNetworkSettings.ps1
│ │ ├── 2-MultipleManagementOS.ps1
│ │ └── 4-MultipleVMMACAddress.ps1
│ ├── VMHost
│ │ └── 1-Paths.ps1
│ └── VhdFile
│ │ ├── 2-CopyFileOrFolder.ps1
│ │ ├── 3-RemoveFileOrFolderFromVhd.ps1
│ │ └── 1-ChangeAttribute.ps1
├── xDhcpServer
│ ├── xDhcpServerAuthorization
│ │ ├── xDhcpServerAuthorization_RemoteServer.ps1
│ │ └── xDhcpServerAuthorization_LocalServer.ps1
│ ├── xDhcpServerClass
│ │ └── xDhcpServerClass.ps1
│ ├── DhcpServerOptionValue
│ │ └── DhcpServerOptionValue.ps1
│ ├── xDhcpServerReservation
│ │ └── xDhcpServerReservation.ps1
│ ├── DhcpPolicyOptionValue
│ │ ├── DhcpPolicyOptionValue_ServerLevel.ps1
│ │ └── DhcpPolicyOptionValue_ScopeLevel.ps1
│ └── DhcpReservedIPOptionValue
│ │ └── DhcpReservedIPOptionValue.ps1
├── SqlServerDsc
│ ├── SqlServerSecureConnection
│ │ ├── 3-SecureConnectionAbsent.ps1
│ │ ├── 1-ForceSecureConnection.ps1
│ │ ├── 2-SecureConnectionNotForced.ps1
│ │ └── 4-SecureConnectionUsingSYSTEMAccount.ps1
│ ├── SqlAgentOperator
│ │ ├── 2-RemoveOperator.ps1
│ │ └── 1-AddOperator.ps1
│ ├── SqlAgentFailsafe
│ │ ├── 2-RemoveFailsafe.ps1
│ │ └── 1-AddFailsafe.ps1
│ ├── SqlWaitForAG
│ │ └── 1-WaitForASingleClusterGroup.ps1
│ ├── SqlRS
│ │ └── 1-DefaultConfiguration.ps1
│ ├── SqlDatabase
│ │ └── 2-DeleteDatabase.ps1
│ ├── SqlServerMaxDop
│ │ └── 3-SetMaxDopToDefault.ps1
│ ├── SqlServerMemory
│ │ └── 4-SetMaxMemoryToDefault.ps1
│ ├── SqlServiceAccount
│ │ └── 1-ConfigureServiceAccount-UserAccount.ps1
│ ├── SqlServerConfiguration
│ │ └── 2-ConfigureInstanceToEnablePriorityBoost.ps1
│ ├── SqlScriptQuery
│ │ └── 1-RunScriptUsingSQLAuthentication.ps1
│ └── SqlAlwaysOnService
│ │ ├── 1-EnableAlwaysOn.ps1
│ │ └── 2-DisableAlwaysOn.ps1
├── AuditPolicyDsc
│ ├── Sample_AuditPolicyOption.ps1
│ ├── Sample_AuditPolicyCsv.ps1
│ ├── Sample_AuditPolicyGuid.ps1
│ └── Sample_AuditPolicySubcategory.ps1
├── SystemLocaleDsc
│ └── SystemLocaleDsc
│ │ └── 1-SetSystemLocale.ps1
├── WebAdministrationDsc
│ ├── SslSettings
│ │ └── Sample_SslSettings_RequireCert.ps1
│ └── IisLogging
│ │ ├── Sample_IisLogging_LogFlags.ps1
│ │ ├── Sample_IisLogging_Rollover.ps1
│ │ └── Sample_IisLogging_Truncate.ps1
├── 7ZipArchiveDsc
│ └── x7ZipArchive.ps1
└── CISDSC
│ └── CIS_Microsoft_Edge_Windows.ps1
├── .gitattributes
├── microsoft
└── server
│ ├── Configure_Firewall.ps1
│ └── Windows_Optional_Feature.ps1
├── templates
└── xoap-dsc-template.ps1
└── citrix
├── XOAP_Citrix_Licensing.ps1
└── XOAP_Citrix_Universal_Print_Server.ps1
/CODEOWNERS.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/scripts/unblock-files.ps1:
--------------------------------------------------------------------------------
1 | Get-ChildItem -Path $home\desktop -File -Recurse | Unblock-File
2 |
--------------------------------------------------------------------------------
/.github/reviewers.yml:
--------------------------------------------------------------------------------
1 | reviewers:
2 | defaults:
3 | - repository-owners
4 | - bbrauneck
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.markdownlint.json:
--------------------------------------------------------------------------------
1 | {
2 | "default": true,
3 | "MD029": {
4 | "style": "one"
5 | },
6 | "MD013": true,
7 | "MD024": false,
8 | "MD034": false,
9 | "no-hard-tabs": true
10 | }
11 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/readme.md:
--------------------------------------------------------------------------------
1 | For more information about Microsoft365DSC and all of the resources,
2 | including details and examples, please check out our
3 | [Wiki](https://github.com/Microsoft/Microsoft365DSC/wiki)
4 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/readme.md:
--------------------------------------------------------------------------------
1 | For more information about SharePointDsc and all of the resources,
2 | including details and examples, please check out our
3 | [Wiki](https://github.com/PowerShell/SharePointDsc/wiki)
4 |
--------------------------------------------------------------------------------
/Microsoft_Examples/AzureConnectedMachineDsc/AzureConnectedMachineAgent.ConfigurationData.ps1:
--------------------------------------------------------------------------------
1 | $configurationData =
2 | @{
3 | AllNodes = @(
4 | @{
5 | NodeName = 'localhost'
6 | PSDscAllowPlainTextPassword = $true
7 | }
8 | )
9 | }
--------------------------------------------------------------------------------
/Microsoft_Examples/xExchange/ConfigureDatabases-FromCalculator/CalculatorAndScripts/E2013Calcv7.6 - Example.xlsm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xoap-io/xoap-powershell-dsc-configurations/HEAD/Microsoft_Examples/xExchange/ConfigureDatabases-FromCalculator/CalculatorAndScripts/E2013Calcv7.6 - Example.xlsm
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/.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 |
6 |
9 |
--------------------------------------------------------------------------------
/.github/workflows/commit-message-validator.yaml:
--------------------------------------------------------------------------------
1 | name: Commit linter
2 | on:
3 | pull_request:
4 | branches: [main, master]
5 | jobs:
6 | commitlint:
7 | runs-on: ubuntu-latest
8 | steps:
9 | - uses: actions/checkout@v4
10 | with:
11 | fetch-depth: 0
12 | - uses: wagoid/commitlint-github-action@v5
13 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Needed for publishing of examples, build worker defaults to core.autocrlf=input.
2 | * text eol=autocrlf
3 |
4 | *.mof text eol=crlf
5 | *.sh text eol=lf
6 | *.svg eol=lf
7 |
8 | # Ensure any exe files are treated as binary
9 | *.exe binary
10 | *.jpg binary
11 | *.xl* binary
12 | *.pfx binary
13 | *.png binary
14 | *.dll binary
15 | *.so binary
16 |
--------------------------------------------------------------------------------
/.idea/xoap-powershell-dsc-configurations.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMClientPushSettings/CMClientPushSettings_Disabled.ps1:
--------------------------------------------------------------------------------
1 | Configuration Example
2 | {
3 | Import-DscResource -ModuleName ConfigMgrCBDsc
4 |
5 | Node localhost
6 | {
7 | CMClientPushSettings Clientsettings
8 | {
9 | SiteCode = 'Lab'
10 | EnableAutomaticClientPushInstallation = $false
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Microsoft_Examples/AzureConnectedMachineDsc/AzureConnectedMachineAgentConfig.ps1:
--------------------------------------------------------------------------------
1 | Configuration AzureConnectedMachineAgentConfig {
2 | Import-DscResource -Module @{ModuleName = 'AzureConnectedMachineDsc'; ModuleVersion = '1.2.0' }
3 |
4 | AzcmagentConfig Ports
5 | {
6 | IsSingleInstance = 'Yes'
7 | incomingconnections_ports = '22'
8 | }
9 | }
10 |
11 | AzureConnectedMachineAgentConfig
12 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | ---
2 | version: 2
3 | updates:
4 | - package-ecosystem: github-actions
5 | directory: /
6 | target-branch: dev
7 | schedule:
8 | interval: daily
9 | labels:
10 | - github-actions
11 | - dependencies
12 | - package-ecosystem: terraform
13 | directory: /
14 | target-branch: dev
15 | schedule:
16 | interval: daily
17 | labels:
18 | - terraform
19 | - dependencies
20 |
--------------------------------------------------------------------------------
/.github/labeler.yml:
--------------------------------------------------------------------------------
1 | Feature:
2 | - head-branch: ['^feature', 'feature']
3 | Hotfix:
4 | - head-branch: ['^hotfix', 'hotfix']
5 | Documentation:
6 | - changed-files:
7 | - any-glob-to-any-file: '**/*.md'
8 | CICD:
9 | - changed-files:
10 | - any-glob-to-any-file: '.github/**'
11 |
12 | typescript:
13 | - changed-files:
14 | - any-glob-to-any-file: '**/*.ts'
15 | css:
16 | - changed-files:
17 | - any-glob-to-any-file: '**/*.css'
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_ServiceSet_StartServices.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Ensures that the DHCP Client and Windows Firewall services are running.
4 | #>
5 | Configuration ServiceSetStartExample
6 | {
7 | Import-DscResource -ModuleName 'PSDscResources'
8 |
9 | ServiceSet ServiceSet1
10 | {
11 | Name = @( 'Dhcp', 'MpsSvc' )
12 | Ensure = 'Present'
13 | State = 'Running'
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMUserDiscovery/CMUserDiscovery_Disabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to set user discovery disabled.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMUserDiscovery ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | Enabled = $false
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMGroupDiscovery/GroupDiscovery_Disabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to set group discovery disabled.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMGroupDiscovery ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | Enabled = $false
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMSystemDiscovery/CMSystemDiscovery_Disabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to set system discovery disabled.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMSystemDiscovery ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | Enabled = $false
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMClientPushSettings/CMClientPushSettings_Include.ps1:
--------------------------------------------------------------------------------
1 | Configuration Example
2 | {
3 | Import-DscResource -ModuleName ConfigMgrCBDsc
4 |
5 | Node localhost
6 | {
7 | CMClientPushSettings Clientsettings
8 | {
9 | SiteCode = 'Lab'
10 | AccountsToInclude = @('contoso\Push1','contoso\Push2')
11 | AccountsToExclude = @('contoso\Push3','contoso\Push4')
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMForestDiscovery/ForestDiscovery_Disabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to disable AD Forest Discovery for Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMForestDiscovery ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | Enabled = $false
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMNetworkDiscovery/CMNetworkDiscovery_Enabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to enable Network Discovery for Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMNetworkDiscovery ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | Enabled = $true
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMNetworkDiscovery/CMNetworkDiscovery_Disabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to disable Network Discovery for Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMNetworkDiscovery ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | Enabled = $false
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMHeartbeatDiscovery/CMHeartbeatDiscovery_Disabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to disable heartbeat discovery in Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMHeartbeatDiscovery ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | Enabled = $false
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/.github/workflows/megalinter.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | name: Linting files
3 | on:
4 | pull_request:
5 | branches: [main, master]
6 | concurrency:
7 | group: ${{ github.ref }}-${{ github.workflow }}
8 | cancel-in-progress: true
9 | jobs:
10 | build:
11 | name: MegaLinter
12 | runs-on: ubuntu-latest
13 | steps:
14 | - name: Checkout Code
15 | uses: actions/checkout@v4
16 | with:
17 | token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
18 | fetch-depth: 0
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMAccounts/CMAccounts_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove an account from Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMAccounts ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | Account = 'domain\User'
15 | Ensure = 'Absent'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_Service_DeleteService.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Stops and then removes the service with the name Service1.
4 | #>
5 | Configuration Sample_Service_DeleteService
6 | {
7 | [CmdletBinding()]
8 | param
9 | ()
10 |
11 | Import-DscResource -ModuleName 'PSDscResources'
12 |
13 | Node localhost
14 | {
15 | Service ServiceResource1
16 | {
17 | Name = 'Service1'
18 | Ensure = 'Absent'
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMEmailNotificationComponent/CMEmailNotificationComponent_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to disable email notification component in Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMEmailNotificationComponent ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | Enabled = $false
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMAdministrativeUser/CMAdministrativeUser_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove an administrative users in Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMAdministrativeUser User1
12 | {
13 | SiteCode = 'Lab'
14 | AdminName = 'contoso\User1'
15 | Ensure = 'Absent'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMFileReplication/CMFileReplication_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration to remove a file replication configuration.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMFileReplication ExampleAbsent
12 | {
13 | SiteCode = 'LAB'
14 | DestinationSiteCode = 'PR1'
15 | Ensure = 'Absent'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMSiteMaintenance/CMSiteMaintenance_Disabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to disable Backup SMS Site Server task.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | Import-DscResource -ModuleName ConfigMgrCBDsc
9 |
10 | Node localhost
11 | {
12 | CMSiteMaintenance BackupTaskDisabled
13 | {
14 | SiteCode = 'Lab'
15 | TaskName = 'Backup SMS Site Server'
16 | Enabled = $false
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/microsoft/server/Configure_Firewall.ps1:
--------------------------------------------------------------------------------
1 | Configuration 'Configure_Firewall'
2 | {
3 | Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
4 | Import-DSCResource -ModuleName 'NetworkingDsc' -ModuleVersion '8.2.0'
5 |
6 | Node 'Configure_Firewall'
7 | {
8 | Firewall 'EnableBuiltInFirewallRule'
9 | {
10 | Name = 'IIS-WebServerRole-HTTP-In-TCP'
11 | Ensure = 'Present'
12 | Enabled = 'True'
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMBoundaryGroups/CMBoundaryGroups_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove a boundary group from Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMBoundaryGroups ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | BoundaryGroup = 'TestGroup'
15 | Ensure = 'Absent'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/OfficeOnlineServerDsc/Resources/OfficeOnlineServerInstall/1-InstallBinaries.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to install the binaries for office online server to the local server.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param()
9 |
10 | Import-DscResource -ModuleName OfficeOnlineServerDsc
11 |
12 | OfficeOnlineServerInstall InstallBinaries
13 | {
14 | Ensure = 'Present'
15 | Path = 'C:\Installer\setup.exe'
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_User_CreateUser.ps1:
--------------------------------------------------------------------------------
1 | Configuration UserExample
2 | {
3 | param (
4 | [System.Management.Automation.PSCredential]
5 | $PasswordCredential
6 | )
7 |
8 | Import-DscResource -ModuleName PSDscResources
9 |
10 | User UserExample
11 | {
12 | Ensure = 'Present' # To ensure the user account does not exist, set Ensure to 'Absent'
13 | UserName = 'SomeUserName'
14 | Password = $PasswordCredential # This needs to be a credential object
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMSecurityScopes/CMSecurityScopes_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove a Security Scope from Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMSecurityScopes Example
12 | {
13 | SiteCode = 'Lab'
14 | SecurityScopeName = 'TestScope1'
15 | Ensure = 'Absent'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/HyperVDsc/VMNetworkAdapter/1-ManagementOS.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .DESCRIPTION
3 | Description not yet written.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName 'HyperVDsc' -Name VMNetworkAdapter
8 | Import-DscResource -ModuleName PSDesiredStateConfiguration
9 |
10 | VMNetworkAdapter HostOSAdapter {
11 | Id = 'Management-NIC'
12 | Name = 'Management-NIC'
13 | SwitchName = 'SETSwitch'
14 | VMName = 'ManagementOS'
15 | Ensure = 'Present'
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Microsoft_Examples/xDhcpServer/xDhcpServerAuthorization/xDhcpServerAuthorization_RemoteServer.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSiS
3 | This example will authorize a remote DHCP server.
4 | #>
5 | configuration Example
6 | {
7 | Import-DscResource -moduleName 'xDhcpServer'
8 |
9 | xDhcpServerAuthorization 'RemoteServerActivation'
10 | {
11 | IsSingleInstance = 'Yes'
12 | Ensure = 'Present'
13 | DnsName = 'ServerToAuthorize.contoso.com'
14 | IPAddress = '192.168.0.1'
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/microsoft/server/Windows_Optional_Feature.ps1:
--------------------------------------------------------------------------------
1 | Configuration 'Windows_Optional_Feature'
2 | {
3 | Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
4 | Import-DscResource -ModuleName 'ComputerManagementDsc' -ModuleVersion '9.0.0'
5 |
6 | Node 'Windows_Optional_Feature'
7 | {
8 | WindowsOptionalFeature 'EnableOptionalFeature'
9 | {
10 | Name = 'TelnetClient'
11 | Ensure = 'Enable'
12 | LogPath = "$env:HOMEDRIVE\WindowsOptionalFeatures"
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMManagementPoint/CMManagementPoint_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove a management point to Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMManagementPoint ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SiteServerName = 'MP01.contoso.com'
15 | Ensure = 'Absent'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMSecurityRoles/CMSecurityRoles_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove Security Roles from Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMSecurityRoles ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SecurityRoleName = 'Field Services'
15 | Ensure = 'Absent'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMDistributionPoint/CMDistributionPoint_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove a distribution point from Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMDistributionPoint ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SiteServerName = 'DP01.contoso.com'
15 | Ensure = 'Absent'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMSiteSystemServer/CMSiteSystemServer_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove a site system server from Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMSiteSystemServer ExampleServer
12 | {
13 | SiteCode = 'Lab'
14 | SiteSystemServer = 'SS01.contoso.com'
15 | Ensure = 'Absent'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMCollections/Collection_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove a collection from Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMCollections ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | CollectionName = 'Test'
15 | CollectionType = 'Device'
16 | Ensure = 'Absent'
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMDistributionGroup/CMDistributionGroup_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove a distribution point group from Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMDistributionGroup ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | DistributionGroup = 'DistroGroup1'
15 | Ensure = 'Absent'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMFallbackStatusPoint/CMFallbackStatusPoint_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove a fallback status point from Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMFallbackStatusPoint ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SiteServerName = 'FSP01.contoso.com'
15 | Ensure = 'Absent'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMPxeDistributionPoint/CMPxeDistributionPoint_Disabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to disable PXE Distribution Point for Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMPxeDistributionPoint ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SiteServerName = 'DP01.contoso.com'
15 | EnablePxe = $false
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMSoftwareUpdatePoint/CMSoftwareUpdatePoint_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove a software update point from Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMSoftwareUpdatePoint ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SiteServerName = 'CA01.contoso.com'
15 | Ensure = 'Absent'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMPullDistributionPoint/CMPullDistributionPoint_Disabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to disable Pull Distribution Point for Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMPullDistributionPoint ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SiteServerName = 'DP01.contoso.com'
15 | EnablePullDP = $false
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMReportingServicePoint/CMReportingServicePoint_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove a software update point from Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMReportingServicePoint ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SiteServerName = 'CA01.contoso.com'
15 | Ensure = 'Absent'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_ProcessSet_Start.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Starts the processes with the executables at the file paths C:\Windows\cmd.exe and
4 | C:\TestPath\TestProcess.exe with no arguments.
5 | #>
6 | Configuration Sample_ProcessSet_Start
7 | {
8 | [CmdletBinding()]
9 | param ()
10 |
11 | Import-DscResource -ModuleName 'PSDscResources'
12 |
13 | ProcessSet ProcessSet1
14 | {
15 | Path = @( 'C:\Windows\System32\cmd.exe', 'C:\TestPath\TestProcess.exe' )
16 | Ensure = 'Present'
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMMaintenanceWindows/CMMaintenanceWindows_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove a maintenance window from collections.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMMaintenanceWindows ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | CollectionName = 'Test'
15 | Name = 'MW1'
16 | Ensure = 'Absent'
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMServiceConnectionPoint/CMServiceConnectionPoint_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove a service connection point from Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMServiceConnectionPoint ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SiteServerName = 'CA01.contoso.com'
15 | Ensure = 'Absent'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/templates/xoap-dsc-template.ps1:
--------------------------------------------------------------------------------
1 | Configuration 'CONFIGURATIONNAME'
2 | {
3 | Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
4 |
5 | Node 'CONFIGURATIONNAME'
6 | {
7 | WindowsOptionalFeature "Microsoft-Hyper-V-All"
8 | {
9 | Name = "Microsoft-Hyper-V-All"
10 | Ensure = "Disable"
11 | }
12 |
13 | File "DemoDirectory"
14 | {
15 | Type = 'Directory'
16 | Ensure = 'Present'
17 | DestinationPath = "C:\DemoDirectory"
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_ServiceSet_BuiltInAccount.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Sets the Secure Socket Tunneling Protocol and DHCP Client services to run under the
4 | built-in account LocalService.
5 | #>
6 | Configuration ServiceSetBuiltInAccountExample
7 | {
8 | Import-DscResource -ModuleName 'PSDscResources'
9 |
10 | ServiceSet ServiceSet1
11 | {
12 | Name = @( 'SstpSvc', 'Dhcp' )
13 | Ensure = 'Present'
14 | BuiltInAccount = 'LocalService'
15 | State = 'Ignore'
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMSoftwareUpdatePoint/CMSoftwareUpdatePoint_Present.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to add a software update point to Configuration Manager with default settings.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMSoftwareUpdatePoint ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SiteServerName = 'CA01.contoso.com'
15 | Ensure = 'Present'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_WindowsOptionalFeatureSet_Disable.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Disables the Windows optional features TelnetClient and LegacyComponents and removes all
4 | files associated with these features.
5 | #>
6 | Configuration WindowsOptionalFeatureSet_Disable
7 | {
8 | Import-DscResource -ModuleName 'PSDscResources'
9 |
10 | WindowsOptionalFeatureSet WindowsOptionalFeatureSet1
11 | {
12 | Name = @('TelnetClient', 'LegacyComponents')
13 | Ensure = 'Absent'
14 | RemoveFilesOnDisable = $true
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMCollectionMembershipEvaluationComponent/CMCollectionMembershipEvaluationComponent_Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to configure the Collection Membership Evaluation Component in Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMCollectionMembershipEvaluationComponent ExampleSettings
12 | {
13 | SiteCode = 'LAB'
14 | EvaluationMins = 5
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMHeartbeatDiscovery/CMHeartbeatDiscovery_Enabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to enable heartbeat discovery in Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMHeartbeatDiscovery ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | Enabled = $true
15 | ScheduleInterval = 'Days'
16 | ScheduleCount = '4'
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMBoundaries/CMBoundaries_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove a boundary from Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMBoundaries ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | DisplayName = 'Subnet 1'
15 | Type = 'IPSubnet'
16 | Value = '10.1.1.0/24'
17 | Ensure = 'Absent'
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMSecurityScopes/CMSecurityScopes_Present.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to add a Security Scope to Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMSecurityScopes Example
12 | {
13 | SiteCode = 'Lab'
14 | SecurityScopeName = 'TestScope1'
15 | Description = 'Test Scope for DSC'
16 | Ensure = 'Present'
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlServerSecureConnection/3-SecureConnectionAbsent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example performs a standard Sql encryption setup. Forcing all connections to be encrypted.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName SqlServerDsc
8 |
9 | node localhost {
10 | SqlServerSecureConnection SecureConnectionAbsent
11 | {
12 | InstanceName = 'MSSQLSERVER'
13 | Thumbprint = ''
14 | Ensure = 'Absent'
15 | ServiceAccount = 'SqlSvc'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/HyperVDsc/VMHost/1-Paths.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .DESCRIPTION
3 | Set paths för the Hyper-V host.
4 | #>
5 | Configuration Example
6 | {
7 | param
8 | (
9 | [Parameter()]
10 | $VirtualHardDiskPath = 'C:\VMDisks',
11 |
12 | [Parameter()]
13 | $VirtualMachinePath = 'C:\VMs'
14 | )
15 |
16 | Import-DscResource -ModuleName 'HyperVDsc'
17 |
18 | VMHost HyperVHostPaths
19 | {
20 | IsSingleInstance = 'Yes'
21 | VirtualHardDiskPath = $VirtualHardDiskPath
22 | VirtualMachinePath = $VirtualMachinePath
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/TeamsPstnUsage/1-AddNewPstnUsage.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example adds a new Teams PSTN Usage.
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobalAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | TeamsPstnUsage 'ConfigurePstnUsage'
17 | {
18 | Usage = 'Long Distance'
19 | Ensure = 'Present'
20 | Credential = $credsGlobalAdmin
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlAgentOperator/2-RemoveOperator.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to ensure that the SQL Agent Operator
4 | DbaTeam does not exist.
5 | #>
6 |
7 | Configuration Example
8 | {
9 |
10 | Import-DscResource -ModuleName SqlServerDsc
11 |
12 | node localhost {
13 | SqlAgentOperator Remove_DbaTeam {
14 | Ensure = 'Absent'
15 | Name = 'DbaTeam'
16 | ServerName = 'TestServer'
17 | InstanceName = 'MSSQLServer'
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Microsoft_Examples/HyperVDsc/VMNetworkAdapter/6-VMVlanTagging.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .DESCRIPTION
3 | Add a network adapter that is using a VLAN tag.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName 'HyperVDsc' -Name VMNetworkAdapter
8 | Import-DscResource -ModuleName PSDesiredStateConfiguration
9 |
10 | VMNetworkAdapter MyVM01NIC {
11 | Id = 'MyVM01-NIC'
12 | Name = 'MyVM01-NIC'
13 | SwitchName = 'SETSwitch'
14 | MacAddress = '001523be0c00'
15 | VMName = 'MyVM01'
16 | VlanId = '1'
17 | Ensure = 'Present'
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMServiceConnectionPoint/CMServiceConnectionPoint_Present.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to add a service connection point to Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMServiceConnectionPoint ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SiteServerName = 'CA01.contoso.com'
15 | Mode = 'Online'
16 | Ensure = 'Present'
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/citrix/XOAP_Citrix_Licensing.ps1:
--------------------------------------------------------------------------------
1 | Configuration 'XOAP_Citrix_Licensing'
2 | {
3 | Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
4 | Import-DscResource -ModuleName 'ComputerManagementDsc' -ModuleVersion '9.0.0'
5 |
6 | Node 'XOAP_Citrix_Licensing'
7 | {
8 | WindowsFeature 'RDS-Licensing'
9 | {
10 | Name = 'RDS-Licensing'
11 | Ensure = 'Present'
12 | }
13 |
14 | WindowsFeature 'RDS-Licensing-UI'
15 | {
16 | Name = 'RDS-Licensing-UI'
17 | Ensure = 'Present'
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMSiteMaintenance/CMSiteMaintenance_UpdateAppCatTablesTask_Enabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to enable and set Update Application Catalog Tables task.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | Import-DscResource -ModuleName ConfigMgrCBDsc
9 |
10 | Node localhost
11 | {
12 | CMSiteMaintenance UpdateAppCatTable
13 | {
14 | SiteCode = 'Lab'
15 | TaskName = 'Update Application Catalog Tables'
16 | Enabled = $true
17 | RunInterval = 1380
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlAgentFailsafe/2-RemoveFailsafe.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to ensure that the SQL Agent
4 | failsafe operator FailsafeOp does not exist.
5 | #>
6 |
7 | Configuration Example
8 | {
9 |
10 | Import-DscResource -ModuleName SqlServerDsc
11 |
12 | node localhost {
13 | SqlAgentFailsafe Remove_FailsafeOp {
14 | Ensure = 'Absent'
15 | Name = 'FailsafeOp'
16 | ServerName = 'TestServer'
17 | InstanceName = 'MSSQLServer'
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Microsoft_Examples/AuditPolicyDsc/Sample_AuditPolicyOption.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example will enable Base Directory auditing on the localhost.
3 | To use this example, run it using PowerShell.
4 | #>
5 | Configuration Sample_AuditOption
6 | {
7 | param
8 | (
9 | [String] $NodeName = 'localhost'
10 | )
11 |
12 | Import-DscResource -ModuleName AuditPolicyDsc
13 |
14 | Node $NodeName
15 | {
16 | AuditPolicyOption AuditBaseDirectories
17 | {
18 | Name = 'AuditBaseDirectories'
19 | Value = 'Enabled'
20 | }
21 | }
22 | }
23 |
24 | Sample_AuditOption
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_RegistryResource_RemoveValue.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Removes the registry key value MyValue from the key
4 | 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'.
5 | #>
6 | Configuration Sample_RegistryResource_RemoveValue
7 | {
8 | Import-DscResource -ModuleName 'PSDscResources'
9 |
10 | Node localhost
11 | {
12 | Registry Registry1
13 | {
14 | Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
15 | Ensure = 'Absent'
16 | ValueName = 'MyValue'
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SystemLocaleDsc/SystemLocaleDsc/1-SetSystemLocale.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example will set the System Locale of LocalHost to 'ja-JP'.
3 | To use this example, run it using PowerShell.
4 | #>
5 | Configuration Example
6 | {
7 | param
8 | (
9 | [Parameter()]
10 | [System.String[]]
11 | $NodeName = 'localhost'
12 | )
13 |
14 | Import-DSCResource -ModuleName SystemLocaleDsc
15 |
16 | Node $NodeName
17 | {
18 | SystemLocale SystemLocaleExample
19 | {
20 | IsSingleInstance = 'Yes'
21 | SystemLocale = 'ja-JP'
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/xDhcpServer/xDhcpServerAuthorization/xDhcpServerAuthorization_LocalServer.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSiS
3 | This example will authorize the local DHCP server.
4 | #>
5 | configuration Example
6 | {
7 | Import-DscResource -ModuleName 'PSDscResources' -ModuleVersion '2.12.0.0'
8 | Import-DscResource -moduleName 'xDhcpServer'
9 |
10 | WindowsFeature 'DHCP'
11 | {
12 | Name = 'DHCP'
13 | Ensure = 'Present'
14 | }
15 |
16 | xDhcpServerAuthorization 'LocalServerActivation'
17 | {
18 | IsSingleInstance = 'Yes'
19 | Ensure = 'Present'
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMAssetIntelligencePoint/CMAssetIntelligencePoint_Absent.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to remove an asset intelligence synchronization point from Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMAssetIntelligencePoint ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SiteServerName = 'CA01.contoso.com'
15 | Ensure = 'Absent'
16 | IsSingleInstance = 'Yes'
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMReportingServicePoint/CMReportingServicePoint_Present.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to add a software update point to Configuration Manager with default settings.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMReportingServicePoint ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SiteServerName = 'CA01.contoso.com'
15 | Username = 'contoso\Admin'
16 | Ensure = 'Present'
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMSoftwareUpdatePointComponent/CMSoftwareUpdatePointComponent_ChildSite.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to modify the Software Update Point Component on a child Primary Site.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMSoftwareUpdatePointComponent ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | LanguageUpdateFiles = @('English','French')
15 | ReportingEvent = 'DoNotCreateWsusReportingEvents'
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_RegistryResource_AddKey.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Create a new registry key called MyNewKey as a subkey under the key
4 | 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'.
5 | #>
6 | Configuration Sample_RegistryResource_AddKey
7 | {
8 | Import-DscResource -ModuleName 'PSDscResources'
9 |
10 | Node localhost
11 | {
12 | Registry Registry1
13 | {
14 | Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\MyNewKey'
15 | Ensure = 'Present'
16 | ValueName = ''
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_RegistryResource_RemoveKey.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Removes the registry key called MyNewKey under the parent key
4 | 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'.
5 | #>
6 | Configuration Sample_RegistryResource_RemoveKey
7 | {
8 | Import-DscResource -ModuleName 'PSDscResources'
9 |
10 | Node localhost
11 | {
12 | Registry Registry1
13 | {
14 | Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\MyNewKey'
15 | Ensure = 'Absent'
16 | ValueName = ''
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/citrix/XOAP_Citrix_Universal_Print_Server.ps1:
--------------------------------------------------------------------------------
1 | Configuration 'XOAP_Citrix_Universal_Print_Server'
2 | {
3 | Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
4 | Import-DscResource -ModuleName 'ComputerManagementDsc' -ModuleVersion '9.0.0'
5 |
6 | Node 'XOAP_Citrix_Universal_Print_Server'
7 | {
8 | WindowsFeature 'Print-Services'
9 | {
10 | Name = 'Print-Services'
11 | Ensure = 'Present'
12 | }
13 |
14 | WindowsFeature 'Print-Server'
15 | {
16 | Name = 'Print-Server'
17 | Ensure = 'Present'
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/scripts/clean-modules.ps1:
--------------------------------------------------------------------------------
1 | # folders where PowerShell looks for modules:
2 | $paths = $env:PSModulePath -split ';'
3 | # finding actual module folders
4 | $modules = Get-ChildItem -Path $paths -Depth 0 -Directory | Sort-Object -Property Name
5 |
6 | $modules |
7 | Select-Object -Property Name, @{N='Parent';E={$_.Parent.FullName}}, FullName |
8 | Out-GridView -Title 'Select module(s) to permanently delete' -PassThru |
9 | Out-GridView -Title 'Do you REALLY want to remove the modules below? CTRL+A and OK to confirm' -PassThru |
10 | Remove-Item -Path { $_.FullName } -Recurse -Force -WhatIf # remove -WhatIf to actually delete (as always at own risk)
11 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMFallbackStatusPoint/CMFallbackStatusPoint_Present.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to add a fallback status point to Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMFallbackStatusPoint ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SiteServerName = 'FSP01.contoso.com'
15 | Ensure = 'Present'
16 | StateMessageCount = '10000'
17 | ThrottleSec = '3600'
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Microsoft_Examples/WebAdministrationDsc/SslSettings/Sample_SslSettings_RequireCert.ps1:
--------------------------------------------------------------------------------
1 | configuration Sample_SslSettings_RequireCert
2 | {
3 | param
4 | (
5 | # Target nodes to apply the configuration
6 | [String[]] $NodeName = 'localhost'
7 | )
8 |
9 | # Import the module that defines custom resources
10 | Import-DscResource -Module WebAdministrationDsc
11 |
12 | Node $NodeName
13 | {
14 | SslSettings SiteDefaults
15 | {
16 | Ensure = 'Present'
17 | Name = 'contoso.com'
18 | Bindings = @('Ssl', 'SslNegotiateCert', 'SslRequireCert')
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Microsoft_Examples/OfficeOnlineServerDsc/Resources/OfficeOnlineServerFarm/1-NewFarm.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to create a basic web apps farm. There are many more options
4 | that can be configured on this resource, but this minimum configuration will deploy
5 | a farm that has editing enabled.
6 | #>
7 |
8 | Configuration Example
9 | {
10 | param()
11 |
12 | Import-DscResource -ModuleName OfficeOnlineServerDsc
13 |
14 | OfficeOnlineServerFarm LocalFarm
15 | {
16 | InternalURL = 'https://officeonline.contoso.com'
17 | EditingEnabled = $true
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Microsoft_Examples/OfficeOnlineServerDsc/Resources/OfficeOnlineServerInstallLanguagePack/1-InstallLanguagePack.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to install a language pack for Office Online
4 | Server. Make sure to use this resource on every Server in the farm.
5 | Currently there is no support for uninstalling the language pack.
6 | #>
7 |
8 | Configuration Example
9 | {
10 | param()
11 |
12 | Import-DscResource -ModuleName OfficeOnlineServerDsc
13 |
14 | OfficeOnlineServerInstallLanguagePack CurrentLanguagePack
15 | {
16 | Ensure = 'Present'
17 | BinaryDir = 'D:\'
18 | Language = 'de-de'
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_WindowsProcess_Start.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Starts the gpresult process which generates a log about the group policy.
4 | The path to the log is provided in 'Arguments'.
5 | #>
6 | Configuration Sample_WindowsProcess_Start
7 | {
8 | param ()
9 |
10 | Import-DSCResource -ModuleName 'PSDscResources'
11 |
12 | Node localhost
13 | {
14 | WindowsProcess GPresult
15 | {
16 | Path = 'C:\Windows\System32\gpresult.exe'
17 | Arguments = '/h C:\gp2.htm'
18 | Ensure = 'Present'
19 | }
20 | }
21 | }
22 |
23 | Sample_WindowsProcess_Start
24 |
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPConfigWizard/1-RunConfigWizard.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example runs the Configuration Wizard as soon as it is applied.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPConfigWizard RunConfigWizard
17 | {
18 | IsSingleInstance = 'Yes'
19 | PsDscRunAsCredential = $SetupAccount
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPProjectServerLicense/2-DisableProjectServer.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example disables Project Server in the current environment
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPProjectServerLicense ProjectLicense
17 | {
18 | IsSingleInstance = 'Yes'
19 | Ensure = 'Absent'
20 | PsDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_Environment_Remove.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Removes the environment variable 'TestEnvironmentVariable' from
4 | both the machine and the process.
5 | #>
6 | Configuration Sample_Environment_Remove
7 | {
8 | param ()
9 |
10 | Import-DscResource -ModuleName 'PSDscResources'
11 |
12 | Node localhost
13 | {
14 | Environment RemoveEnvironmentVariable
15 | {
16 | Name = 'TestEnvironmentVariable'
17 | Ensure = 'Absent'
18 | Path = $false
19 | Target = @('Process', 'Machine')
20 | }
21 | }
22 | }
23 |
24 | Sample_Environment_Remove
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPFarmPropertyBag/1-RemoveFarmPropertyBag.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how remove property bag in the current farm.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param
9 | (
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 |
15 | Import-DscResource -ModuleName SharePointDsc
16 |
17 | node localhost
18 | {
19 | SPFarmPropertyBag APPLICATION_APPCodeProperty
20 | {
21 | PsDscRunAsCredential = $SetupAccount
22 | Key = 'KeyToRemove'
23 | Ensure = 'Absent'
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlServerSecureConnection/1-ForceSecureConnection.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example performs a standard Sql encryption setup. Forcing all connections to be encrypted.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName SqlServerDsc
8 |
9 | node localhost {
10 | SqlServerSecureConnection ForceSecureConnection
11 | {
12 | InstanceName = 'MSSQLSERVER'
13 | Thumbprint = 'fb0b82c94b80da26cf0b86f10ec0c50ae7864a2c'
14 | ForceEncryption = $true
15 | Ensure = 'Present'
16 | ServiceAccount = 'SqlSvc'
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Microsoft_Examples/xExchange/EndToEndExample/Calculators/Lab/Servers.csv:
--------------------------------------------------------------------------------
1 | 'ServerName','StartDrive','DbPerVolume','AutoReseedVolumes','DbLogIsolation','VolumesRootFolder','DatabasesRootFolder','DbMap'
2 | 'VersionNumber','2.1','6.6',,,,''
3 | 'E15-1','5',4,'1','0','C:\ExchangeVolumes','C:\ExchangeDatabases','DAG-nn-DB1,DAG-nn-DB2,DAG-nn-DB3,DAG-nn-DB4'
4 | 'E15-3','5',4,'1','0','C:\ExchangeVolumes','C:\ExchangeDatabases','DAG-nn-DB1,DAG-nn-DB2,DAG-nn-DB3,DAG-nn-DB4'
5 | 'E15-2','5',4,'1','0','C:\ExchangeVolumes','C:\ExchangeDatabases','DAG-nn-DB1,DAG-nn-DB2,DAG-nn-DB3,DAG-nn-DB4'
6 | 'E15-4','5',4,'1','0','C:\ExchangeVolumes','C:\ExchangeDatabases','DAG-nn-DB1,DAG-nn-DB2,DAG-nn-DB3,DAG-nn-DB4'
7 |
--------------------------------------------------------------------------------
/Microsoft_Examples/7ZipArchiveDsc/x7ZipArchive.ps1:
--------------------------------------------------------------------------------
1 | $output = 'C:\Example\MOF'
2 |
3 | Configuration Example
4 | {
5 | Import-DscResource -ModuleName 7ZipArchiveDsc
6 | Node localhost
7 | {
8 | x7ZipArchive sample1 {
9 | Path = 'C:\sample.zip'
10 | Destination = 'C:\Destination'
11 | Validate = $true
12 | Checksum = 'Size'
13 | Clean = $true
14 | }
15 | }
16 | }
17 |
18 | Example -OutputPath $output
19 | Start-DscConfiguration -Path $output -Verbose -wait
20 |
21 | Remove-DscConfigurationDocument -Stage Previous, Pending, Current -Force
22 | Remove-Item $output -Recurse -Force
23 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_Group_RemoveMembers.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | If the group named GroupName1 does not exist, creates a group named GroupName1.
4 |
5 | If the group named GroupName1 already exists removes the users that have the usernames
6 | Username1 or Username2 from the group.
7 | #>
8 | Configuration Sample_Group_RemoveMembers
9 | {
10 | [CmdletBinding()]
11 | param ()
12 |
13 | Import-DscResource -ModuleName 'PSDscResources'
14 |
15 | Group Group1
16 | {
17 | GroupName = 'GroupName1'
18 | Ensure = 'Present'
19 | MembersToExclude = @( 'Username1', 'Username2' )
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_WindowsProcess_Stop.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Stops the gpresult process if it is running.
4 | Since the Arguments parameter isn't needed to stop the process,
5 | an empty string is passed in.
6 | #>
7 | Configuration Sample_WindowsProcess_Stop
8 | {
9 | param ()
10 |
11 | Import-DSCResource -ModuleName 'PSDscResources'
12 |
13 | Node localhost
14 | {
15 | WindowsProcess GPresult
16 | {
17 | Path = 'C:\Windows\System32\gpresult.exe'
18 | Arguments = ''
19 | Ensure = 'Absent'
20 | }
21 | }
22 | }
23 |
24 | Sample_WindowsProcess_Stop
25 |
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlAgentOperator/1-AddOperator.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to ensure that the SQL Agent Operator
4 | DbaTeam exists with the correct email address.
5 | #>
6 |
7 | Configuration Example
8 | {
9 |
10 | Import-DscResource -ModuleName SqlServerDsc
11 |
12 | node localhost {
13 | SqlAgentOperator Add_DbaTeam {
14 | Ensure = 'Present'
15 | Name = 'DbaTeam'
16 | ServerName = 'TestServer'
17 | InstanceName = 'MSSQLServer'
18 | EmailAddress = 'dbateam@company.com'
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/TeamsGuestCallingConfiguration/1-ConfigureTeamsGuestCalling.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example configures the Teams Guest Calling Configuration.
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobalAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | TeamsGuestCallingConfiguration 'ConfigureGuestCalling'
17 | {
18 | Identity = "Global"
19 | AllowPrivateCalling = $True
20 | Credential = $credsGlobalAdmin
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_WindowsFeatureSet_Install.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Installs the TelnetClient and RSAT-File-Services Windows features, including all their
4 | subfeatures. Logs the operation to the file at 'C:\LogPath\Log.log'.
5 | #>
6 | Configuration WindowsFeatureSetExample_Install
7 | {
8 | [CmdletBinding()]
9 | param ()
10 |
11 | Import-DscResource -ModuleName 'PSDscResources'
12 |
13 | WindowsFeatureSet WindowsFeatureSet1
14 | {
15 | Name = @( 'Telnet-Client', 'RSAT-File-Services' )
16 | Ensure = 'Present'
17 | IncludeAllSubFeature = $true
18 | LogPath = 'C:\LogPath\Log.log'
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_WindowsOptionalFeatureSet_Enable.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Enables the Windows optional features MicrosoftWindowsPowerShellV2 and
4 | Internet-Explorer-Optional-amd64 and outputs a log of the operations to a file at the path
5 | 'C:\LogPath\Log.txt'.
6 | #>
7 | Configuration WindowsOptionalFeatureSet_Enable
8 | {
9 | Import-DscResource -ModuleName 'PSDscResources'
10 |
11 | WindowsOptionalFeatureSet WindowsOptionalFeatureSet1
12 | {
13 | Name = @('MicrosoftWindowsPowerShellV2', 'Internet-Explorer-Optional-amd64')
14 | Ensure = 'Present'
15 | LogPath = 'C:\LogPath\Log.txt'
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPProjectServerLicense/1-EnableProjectServer.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example enables Project Server in the current environment
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPProjectServerLicense ProjectLicense
17 | {
18 | IsSingleInstance = 'Yes'
19 | ProductKey = 'XXXXX-XXXXX-XXXXX-XXXXX-XXXXX'
20 | PsDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/WebAdministrationDsc/IisLogging/Sample_IisLogging_LogFlags.ps1:
--------------------------------------------------------------------------------
1 | configuration Sample_IisLogging_LogFlags
2 | {
3 | param
4 | (
5 | # Target nodes to apply the configuration
6 | [String[]] $NodeName = 'localhost'
7 | )
8 |
9 | # Import the module that defines custom resources
10 | Import-DscResource -Module WebAdministrationDsc
11 |
12 | Node $NodeName
13 | {
14 | IisLogging Logging
15 | {
16 | LogPath = 'C:\IISLogFiles'
17 | Logflags = @('Date', 'Time', 'ClientIP', 'ServerIP', 'UserAgent')
18 | LogFormat = 'W3C'
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Microsoft_Examples/OfficeOnlineServerDsc/Resources/OfficeOnlineServerMachine/1-JoinFarm.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to join a machine to an Office Web Apps farm. This
4 | shows that the new server will use all roles (it is not recommended to
5 | split roles out to dedicated servers for Office Online Server farms of
6 | less than 50 servers).
7 | #>
8 |
9 | Configuration Example
10 | {
11 | param()
12 |
13 | Import-DscResource -ModuleName OfficeOnlineServerDsc
14 |
15 | OfficeOnlineServerMachine JoinFarm
16 | {
17 | MachineToJoin = 'office1.contoso.com'
18 | Roles = 'All'
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_ProcessSet_Stop.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Stops the processes with the executables at the file paths C:\Windows\cmd.exe and
4 | C:\TestPath\TestProcess.exe with no arguments and logs any output to the path
5 | C:\OutputPath\Output.log.
6 | #>
7 | Configuration Sample_ProcessSet_Stop
8 | {
9 | [CmdletBinding()]
10 | param ()
11 |
12 | Import-DscResource -ModuleName 'PSDscResources'
13 |
14 | ProcessSet ProcessSet1
15 | {
16 | Path = @( 'C:\Windows\System32\cmd.exe', 'C:\TestPath\TestProcess.exe' )
17 | Ensure = 'Absent'
18 | StandardOutputPath = 'C:\OutputPath\Output.log'
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_WindowsFeatureSet_Uninstall.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Uninstalls the TelnetClient and RSAT-File-Services Windows features, including all their
4 | subfeatures. Logs the operation to the file at 'C:\LogPath\Log.log'.
5 | #>
6 | Configuration WindowsFeatureSetExample_Install
7 | {
8 | [CmdletBinding()]
9 | param ()
10 |
11 | Import-DscResource -ModuleName 'PSDscResources'
12 |
13 | WindowsFeatureSet WindowsFeatureSet1
14 | {
15 | Name = @( 'Telnet-Client', 'RSAT-File-Services' )
16 | Ensure = 'Absent'
17 | IncludeAllSubFeature = $true
18 | LogPath = 'C:\LogPath\Log.log'
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPProjectServerGroup/2-ADGroup.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to create a PWA group mapped to a group in AD
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost
16 | {
17 | SPProjectServerGroup Group
18 | {
19 | Url = 'http://projects.contoso.com'
20 | Name = 'My group'
21 | ADGroup = 'Domain\Group'
22 | PSDscRunAsCredential = $SetupAccount
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlAgentFailsafe/1-AddFailsafe.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to ensure that the SQL Agent
4 | Failsafe Operator 'FailsafeOp' exists with the correct Notification.
5 | #>
6 |
7 | Configuration Example
8 | {
9 |
10 | Import-DscResource -ModuleName SqlServerDsc
11 |
12 | node localhost {
13 | SqlAgentFailsafe Add_FailsafeOp {
14 | Ensure = 'Present'
15 | Name = 'FailsafeOp'
16 | ServerName = 'TestServer'
17 | InstanceName = 'MSSQLServer'
18 | NotificationMethod = 'NotifyEmail'
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlServerSecureConnection/2-SecureConnectionNotForced.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example performs a standard Sql encryption setup. All connections are not forced to be encrypted.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName SqlServerDsc
8 |
9 | node localhost {
10 | SqlServerSecureConnection SecureConnectionNotForced
11 | {
12 | InstanceName = 'MSSQLSERVER'
13 | Thumbprint = 'fb0b82c94b80da26cf0b86f10ec0c50ae7864a2c'
14 | ForceEncryption = $false
15 | Ensure = 'Present'
16 | ServiceAccount = 'SqlSvc'
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Microsoft_Examples/AuditPolicyDsc/Sample_AuditPolicyCsv.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example will apply the audit policy settings in the CSV located at
3 | C:\data\AuditPolBackup.csv to the localhost.
4 | To use this example, run it using PowerShell.
5 | #>
6 | Configuration Sample_AuditPolicyCsv
7 | {
8 | param
9 | (
10 | [String] $NodeName = 'localhost'
11 | )
12 |
13 | Import-DscResource -ModuleName AuditPolicyDsc
14 |
15 | Node $NodeName
16 | {
17 | AuditPolicyCsv auditPolicy
18 | {
19 | IsSingleInstance = 'Yes'
20 | CsvPath = "C:\data\AuditPolBackup.csv"
21 | }
22 | }
23 | }
24 |
25 | Sample_AuditPolicyCsv
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/PlannerPlan/1-NewPlannerPlan.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example creates a new Plan in Planner.
3 | #>
4 |
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName Microsoft365DSC
8 |
9 | node localhost
10 | {
11 | PlannerPlan 'ContosoPlannerPlan'
12 | {
13 | Title = "Contoso Plan"
14 | OwnerGroup = "Contoso Group"
15 | Ensure = "Present"
16 | ApplicationId = "12345-12345-12345-12345-12345"
17 | TenantId = "12345-12345-12345-12345-12345"
18 | CertificateThumbprint = "1234567890"
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPProjectServerADResourcePoolSync/2-DisableSync.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example disables Project Server AD resource pool sync
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPProjectServerADResourcePoolSync EnableSync
17 | {
18 | Ensure = 'Absent'
19 | Url = 'http://projects.contoso.com/pwa'
20 | PsDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/IntuneAppConfigurationPolicy/1-NewAppConfigurationPolicy.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example creates a new App Configuration Policy.
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobalAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | IntuneAppConfigurationPolicy 'AddAppConfigPolicy'
17 | {
18 | DisplayName = 'ContosoNew'
19 | Description = 'New Contoso Policy'
20 | Ensure = 'Present'
21 | Credential = $credsGlobalAdmin
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/IntuneDeviceCategory/1-NewDeviceCategory.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example creates a new Device Category.
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobalAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | IntuneDeviceCategory 'ConfigureDeviceCategory'
17 | {
18 | DisplayName = "Contoso"
19 | Description = "Contoso Category"
20 | Ensure = "Present"
21 | Credential = $credsGlobalAdmin
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPFarmPropertyBag/1-AddFarmPropertyBag.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how add property bag in the current farm.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param
9 | (
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 |
15 | Import-DscResource -ModuleName SharePointDsc
16 |
17 | node localhost
18 | {
19 | SPFarmPropertyBag APPLICATION_APPCodeProperty
20 | {
21 | PsDscRunAsCredential = $SetupAccount
22 | Key = 'FARM_TYPE'
23 | Value = 'SearchFarm'
24 | Ensure = 'Present'
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPProjectServerWssSettings/1-Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example demonstrates how to set WSS settings for a PWA site
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost
16 | {
17 | SPProjectServerWssSettings WssSettings
18 | {
19 | Url = 'http://projects.contoso.com/pwa'
20 | CreateProjectSiteMode = 'AutoCreate'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPAppCatalog/1-SetSiteAsAppCatalog.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to configure the AppCatalog in the farm
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPAppCatalog MainAppCatalog
17 | {
18 | SiteUrl = 'https://content.sharepoint.contoso.com/sites/AppCatalog'
19 | PsDscRunAsCredential = $SetupAccount
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPProjectServerPermissionMode/1-SPMode.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to a specific PWA site to use SharePoint permission mode.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPProjectServerPermissionMode PermissionMode
17 | {
18 | Url = 'http://projects.contoso.com'
19 | PermissionMode = 'SharePoint'
20 | PsDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/IntuneAppConfigurationPolicy/1-RemoveAppConfigurationPolicy.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example removes an existing App Configuration Policy.
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobalAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | IntuneAppConfigurationPolicy 'RemoveAppConfigPolicy'
17 | {
18 | DisplayName = 'ContosoOld'
19 | Description = 'Old Contoso Policy'
20 | Ensure = 'Absent'
21 | Credential = $credsGlobalAdmin
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/PlannerBucket/1-NewPlannerBucket.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example creates a new Planner Bucket in a Plan.
3 | #>
4 |
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName Microsoft365DSC
8 |
9 | node localhost
10 | {
11 | PlannerBucket 'ContosoPlannerBucket'
12 | {
13 | PlanId = "1234567890"
14 | Name = "Contoso Bucket"
15 | Ensure = "Present"
16 | ApplicationId = "12345-12345-12345-12345-12345"
17 | TenantId = "12345-12345-12345-12345-12345"
18 | CertificateThumbprint = "1234567890"
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Microsoft_Examples/CISDSC/CIS_Microsoft_Edge_Windows.ps1:
--------------------------------------------------------------------------------
1 | #Requires -module CISDSC
2 | #Requires -RunAsAdministrator
3 |
4 | <#
5 | .DESCRIPTION
6 | Applies CIS Level one benchmarks for Microsoft Edge with no exclusions on Windows.
7 | Exclusion documentation can be found in the docs folder of this module.
8 | #>
9 |
10 | Configuration Microsoft_Edge_CIS_L1
11 | {
12 | Import-DSCResource -ModuleName 'CISDSC' -Name 'CIS_Microsoft_Edge_Windows'
13 |
14 | node 'localhost'
15 | {
16 | CIS_Microsoft_Edge_Windows 'Microsoft Edge CISBenchmarks'
17 | {
18 | }
19 | }
20 | }
21 |
22 | Microsoft_Edge_CIS_L1
23 | Start-DscConfiguration -Path '.\Microsoft_Edge_CIS_L1' -Verbose -Wait
24 |
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMManagementPoint/CMManagementPoint_Present.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to add a mangement point to Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMManagementPoint ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SiteServerName = 'MP01.contoso.com'
15 | Ensure = 'Present'
16 | EnableSSL = $true
17 | GenerateAlert = $true
18 | UseSiteDatabase = $true
19 | UseComputerAccount = $true
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMSiteMaintenance/CMSiteMaintenance_BackupTask_Enabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to enable Backup SMS Site Server backup task.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | Import-DscResource -ModuleName ConfigMgrCBDsc
9 |
10 | Node localhost
11 | {
12 | CMSiteMaintenance BackupTask
13 | {
14 | SiteCode = 'Lab'
15 | TaskName = 'Backup SMS Site Server'
16 | Enabled = $true
17 | DaysOfWeek = 'Sunday'
18 | BeginTime = '0100'
19 | LatestBeginTime = '0500'
20 | BackupLocation = 'C:\Temp'
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPProjectServerPermissionMode/2-PSMode.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to a specific PWA site to use Project server
4 | permission mode.
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPProjectServerPermissionMode PermissionMode
18 | {
19 | Url = 'http://projects.contoso.com'
20 | PermissionMode = 'ProjectServer'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMSiteMaintenance/CMSiteMaintenance_SummaryTask_Enabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to enable Summarize Installed Software Data summary task.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | Import-DscResource -ModuleName ConfigMgrCBDsc
9 |
10 | Node localhost
11 | {
12 | CMSiteMaintenance SummaryTask
13 | {
14 | SiteCode = 'Lab'
15 | TaskName = 'Summarize Installed Software Data'
16 | Enabled = $true
17 | DaysOfWeek = @('Friday','WednesDay','Monday')
18 | BeginTime = '0000'
19 | LatestBeginTime = '0400'
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Microsoft_Examples/HyperVDsc/VhdFile/2-CopyFileOrFolder.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .DESCRIPTION
3 | Not yet written.
4 | #>
5 | Configuration Example
6 | {
7 | param
8 | (
9 | [Parameter()]
10 | $vhdPath = 'C:\temp\disk.vhdx',
11 |
12 | [Parameter()]
13 | $itemToCopy = 'C:\Temp',
14 |
15 | [Parameter()]
16 | $relativeDestinationPath = 'Temp'
17 | )
18 |
19 | Import-DscResource -ModuleName 'HyperVDsc'
20 |
21 | VhdFile FileCopy
22 | {
23 | VhdPath = $vhdPath
24 | FileDirectory = DSC_FileDirectory
25 | {
26 | SourcePath = $itemToCopy
27 | DestinationPath = $relativeDestinationPath
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPAppDomain/1-SetAppDomainDetails.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to apply app URLs to the current farm.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPAppDomain LocalFarmAppUrls
17 | {
18 | AppDomain = 'contosointranetapps.com'
19 | Prefix = 'app'
20 | PsDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPSitePropertyBag/2-RemoveWebAppPropertyBag.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how remove a property bag value in a site collection.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param
9 | (
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 |
15 | Import-DscResource -ModuleName SharePointDsc
16 |
17 | node localhost
18 | {
19 | SPSitePropertyBag Site_APPCodeProperty
20 | {
21 | PsDscRunAsCredential = $SetupAccount
22 | Url = 'https://web.contoso.com'
23 | Key = 'KeyToRemove'
24 | Ensure = 'Absent'
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPWordAutomationServiceApp/2-RemoveServiceApp.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example removes a word automation service app
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPWordAutomationServiceApp WordAutomation
17 | {
18 | Name = 'Word Automation Service Application'
19 | Ensure = 'Absent'
20 | PsDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/HyperVDsc/VhdFile/3-RemoveFileOrFolderFromVhd.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .DESCRIPTION
3 | Not yet written.
4 | #>
5 | Configuration Example
6 | {
7 | param
8 | (
9 | [Parameter()]
10 | $vhdPath = 'C:\temp\disk.vhdx',
11 |
12 | [Parameter()]
13 | $relativeDestinationPath = 'Temp',
14 |
15 | [Parameter()]
16 | $Ensure = 'Absent'
17 | )
18 |
19 | Import-DscResource -ModuleName 'HyperVDsc'
20 |
21 | VhdFile RemoveFile
22 | {
23 | VhdPath = $vhdPath
24 | FileDirectory = DSC_FileDirectory
25 | {
26 | DestinationPath = $relativeDestinationPath
27 | Ensure = $Ensure
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/IntuneDeviceCompliancePolicyAndroid/2-RemoveDeviceCompliancePolicyAndroid.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example removes an existing Device Compliance Policy for iOs devices
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobalAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | IntuneDeviceCompliancePolicyAndroid 'RemoveDeviceCompliancePolicyAndroid'
17 | {
18 | DisplayName = "Test Android Device Compliance Policy"
19 | Ensure = "Absent"
20 | Credential = $credsGlobalAdmin
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/SCFilePlanPropertySubCategory/1-AddingNewFilePlanPropertySubCategory.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example shows how to create a new File Plan Property Sub-Category.
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobalAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | SCFilePlanPropertySubCategory 'FilePlanPropertySubCategory'
17 | {
18 | Name = "My Sub-Category"
19 | Category = "My Category"
20 | Ensure = "Present"
21 | Credential = $credsGlobalAdmin
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPAuthenticationRealm/1-Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example sets the farm atuhentication realm.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPAuthenticationRealm AuthenticationRealm
17 | {
18 | IsSingleInstance = 'Yes'
19 | AuthenticationRealm = '14757a87-4d74-4323-83b9-fb1e77e8f22f'
20 | PsDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPWebAppPropertyBag/2-RemoveWebAppPropertyBag.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how remove a property bag value in a web application.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param
9 | (
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 |
15 | Import-DscResource -ModuleName SharePointDsc
16 |
17 | node localhost
18 | {
19 | SPWebAppPropertyBag APPLICATION_APPCodeProperty
20 | {
21 | PsDscRunAsCredential = $SetupAccount
22 | WebAppUrl = 'https://web.contoso.com'
23 | Key = 'KeyToRemove'
24 | Ensure = 'Absent'
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/IntuneDeviceCompliancePolicyiOs/2-RemoveDeviceCompliancePolicyiOs.ps1.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example removes an existing Device Compliance Policy for iOs devices
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobalAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | IntuneDeviceCompliancePolicyiOs 'RemoveDeviceCompliancePolicyiOS'
17 | {
18 | DisplayName = 'Demo iOS Device Compliance Policy'
19 | Ensure = 'Absent'
20 | Credential = $credsGlobalAdmin
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/SPOTenantCdnEnabled/1-ConfigureCDN.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | SPOTenantCdnEnabled 'ConfigureCDN'
18 | {
19 | Enable = $True
20 | CdnType = "Public"
21 | Ensure = "Present"
22 | Credential = $credsGlobalAdmin
23 | }
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPMinRoleCompliance/1-EnsureCompliance.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to ensure the farm is always compliant with MinRole settings
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPMinRoleCompliance MinRoleCompliance
17 | {
18 | IsSingleInstance = 'Yes'
19 | State = 'Compliant'
20 | PSDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPPowerPointAutomationServiceApp/2-RemoveServiceApp.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example removes a word automation service app
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPPowerPointAutomationServiceApp WordAutomation
17 | {
18 | Name = 'PowerPoint Automation Service Application'
19 | Ensure = 'Absent'
20 | PsDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/xDhcpServer/xDhcpServerClass/xDhcpServerClass.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSiS
3 | This example creates a new DHCP Server class.
4 | #>
5 | configuration Example
6 | {
7 | Import-DscResource -ModuleName 'PSDscResources' -ModuleVersion '2.12.0.0'
8 | Import-DscResource -moduleName 'xDhcpServer'
9 |
10 | WindowsFeature 'DHCP'
11 | {
12 | Name = 'DHCP'
13 | Ensure = 'Present'
14 | }
15 |
16 | xDhcpServerClass 'VendorClass'
17 | {
18 | ensure = 'Present'
19 | Name = 'VendorClass'
20 | Type = 'Vendor'
21 | AsciiData = 'sampledata'
22 | AddressFamily = 'IPv4'
23 | Description = 'Vendor Class Description'
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMClientStatusSettings/CMClientStatusSettings.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to modify client status settings.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMClientStatusSettings ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | IsSingleInstance = 'Yes'
15 | ClientPolicyDays = 7
16 | HeartbeatDiscoveryDays = 7
17 | SoftwareInventoryDays = 7
18 | HardwareInventoryDays = 7
19 | StatusMessageDays = 7
20 | HistoryCleanupDays = 31
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPWebAppProxyGroup/1-Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to assign a specific proxy group to the specified web app
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPWebAppProxyGroup ContosoWeb
17 | {
18 | WebAppUrl = 'https://web.contoso.com'
19 | ServiceAppProxyGroup = 'Proxy Group 1'
20 | PsDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/xDhcpServer/DhcpServerOptionValue/DhcpServerOptionValue.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSiS
3 | This example sets an option ID 8 (cookie servers) on a server level.
4 | #>
5 | configuration Example
6 | {
7 | Import-DscResource -ModuleName 'PSDscResources' -ModuleVersion '2.12.0.0'
8 | Import-DscResource -moduleName 'xDhcpServer'
9 |
10 | WindowsFeature 'DHCP'
11 | {
12 | Name = 'DHCP'
13 | Ensure = 'Present'
14 | }
15 |
16 | DhcpServerOptionValue 'ServerOptionValue_ID-008'
17 | {
18 | OptionId = 8
19 | Value = '1.1.1.1'
20 | VendorClass = ''
21 | UserClass = ''
22 | AddressFamily = 'IPv4'
23 | Ensure = 'Present'
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/IntuneDeviceCompliancePolicyMacOS/2-RemoveDeviceCompliancePolicyMacOS.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example removes an existing Device Compliance Policy for MacOS devices
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobalAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | IntuneDeviceCompliancePolicyMacOS 'RemoveDeviceCompliancePolicyMacOS'
17 | {
18 | DisplayName = 'Demo MacOS Device Compliance Policy'
19 | Ensure = 'Absent'
20 | Credential = $credsGlobalAdmin
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPProjectServerAdditionalSettings/1-Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to apply additional settings to the PWA site
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost
16 | {
17 | SPProjectServerAdditionalSettings Settings
18 | {
19 | Url = 'http://projects.contoso.com/pwa'
20 | ServerCurrency = 'AUD'
21 | EnforceServerCurrency = $true
22 | PsDscRunAsCredential = $SetupAccount
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/EXOAcceptedDomain/1-ConfigureAcceptedDomain.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | EXOAcceptedDomain 'O365DSCDomain'
18 | {
19 | Identity = 'contoso.com'
20 | DomainType = "Authoritative"
21 | Ensure = "Present"
22 | Credential = $credsGlobalAdmin
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPAppStoreSettings/1-EnableSharePointAppStore.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to configure the AppCatalog in the farm
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPAppStoreSettings EnableSharePointAppStore
17 | {
18 | WebAppUrl = 'https://sharepoint.contoso.com'
19 | AllowAppPurchases = $true
20 | PsDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPSitePropertyBag/1-AddWebAppPropertyBag.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how add property bag value in a site collection.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param
9 | (
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 |
15 | Import-DscResource -ModuleName SharePointDsc
16 |
17 | node localhost
18 | {
19 | SPSitePropertyBag Site_APPCodeProperty
20 | {
21 | PsDscRunAsCredential = $SetupAccount
22 | Url = 'https://web.contoso.com'
23 | Key = 'KeyToAdd'
24 | Value = 'ValueToAddOrModify'
25 | Ensure = 'Present'
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Microsoft_Examples/HyperVDsc/VMNetworkAdapter/5-VMStaticNetworkSettings.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .DESCRIPTION
3 | Add a network adapter that is using static IP address.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName 'HyperVDsc'
8 |
9 | VMNetworkAdapter MyVM01NIC
10 | {
11 | Ensure = 'Present'
12 | Id = 'MyVM01-NIC'
13 | Name = 'MyVM01-NIC'
14 | SwitchName = 'SETSwitch'
15 | MacAddress = '001523be0c00'
16 | VMName = 'MyVM01'
17 | NetworkSetting = NetworkSettings
18 | {
19 | IpAddress = '192.168.0.100'
20 | Subnet = '255.255.255.255'
21 | DefaultGateway = '192.168.0.1'
22 | DnsServer = '192.168.0.1'
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPIrmSettings/1-ApplyIRMSConfig.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to apply the RMS settings to a local farm, pointing to
4 | a specific RMS server
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPIrmSettings RMSSettings
18 | {
19 | IsSingleInstance = 'Yes'
20 | RMSserver = 'https://rms.contoso.com'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/O365OrgCustomizationSetting/1-EnableCustomizationSetting.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 |
14 | Import-DscResource -ModuleName Microsoft365DSC
15 |
16 | node localhost
17 | {
18 | O365OrgCustomizationSetting 'O365OrgCustomizationSetting'
19 | {
20 | IsSingleInstance = "Yes"
21 | Ensure = "Present"
22 | Credential = $credsGlobalAdmin
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/SPOSiteAuditSettings/1-ConfigureSiteAuditSettings.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | SPOSiteAuditSettings 'ConfigureSiteAuditSettings '
18 | {
19 | Url = "https://contoso.sharepoint.com/sites/DemoSite"
20 | AuditFlags = "All"
21 | Credential = $credsGlobalAdmin
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPProjectServerADResourcePoolSync/1-EnableSync.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example enables Project Server AD resource pool sync
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPProjectServerADResourcePoolSync EnableSync
17 | {
18 | Ensure = 'Present'
19 | Url = 'http://projects.contoso.com/pwa'
20 | GroupNames = @('DOMAIN\Group 1', 'DOMAIN\Group 2')
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPShellAdmins/1-FarmAdmins.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example gives admin access to the specified users for the local farm as well as
4 | all content databases in the local farm.
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPShellAdmins ShellAdmins
18 | {
19 | IsSingleInstance = 'Yes'
20 | Members = 'CONTOSO\user1', 'CONTOSO\user2'
21 | AllDatabases = $true
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPWebAppPermissions/2-AllPermissions.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to ensure all permissions are available for a web app
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPWebAppPermissions WebApplicationPermissions
17 | {
18 | WebAppUrl = 'https://portal.sharepoint.contoso.com'
19 | AllPermissions = $true
20 | PsDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/HyperVDsc/VMNetworkAdapter/2-MultipleManagementOS.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .DESCRIPTION
3 | Description not yet written.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName 'HyperVDsc' -Name VMNetworkAdapter
8 | Import-DscResource -ModuleName PSDesiredStateConfiguration
9 |
10 | VMNetworkAdapter ManagementAdapter {
11 | Id = 'Management-NIC'
12 | Name = 'Management-NIC'
13 | SwitchName = 'SETSwitch'
14 | VMName = 'ManagementOS'
15 | Ensure = 'Present'
16 | }
17 |
18 | VMNetworkAdapter ClusterAdapter {
19 | Id = 'Cluster-NIC'
20 | Name = 'Cluster-NIC'
21 | SwitchName = 'SETSwitch'
22 | VMName = 'ManagementOS'
23 | Ensure = 'Present'
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/IntuneDeviceCompliancePolicyWindows10/2-RemoveDeviceCompliancePolicyWindows10.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example removes an existing Device Compliance Policy for MacOS devices
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobalAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | IntuneDeviceCompliancePolicyWindows10 'RemoveDeviceCompliancePolicyWindows10'
17 | {
18 | DisplayName = 'Demo Windows 10 Device Compliance Policy'
19 | Ensure = 'Absent'
20 | Credential = $credsGlobalAdmin
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/PPPowerAppsEnvironment/1-NewPowerAppsEnvironment.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example creates a new PowerApps environment in production.
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobalAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | PPPowerAppsEnvironment 'PowerAppsDemoEnvironment'
17 | {
18 | DisplayName = "My Demo Environment"
19 | EnvironmentSKU = "Production"
20 | Location = "canada"
21 | Ensure = "Present"
22 | Credential = $credsGlobalAdmin
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlWaitForAG/1-WaitForASingleClusterGroup.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example will wait for the cluster role/group 'AGTest1'.
4 | #>
5 | Configuration Example
6 | {
7 | param
8 | (
9 | [Parameter(Mandatory = $true)]
10 | [System.Management.Automation.PSCredential]
11 | $SqlAdministratorCredential
12 | )
13 |
14 | Import-DscResource -ModuleName SqlServerDsc
15 |
16 | node localhost
17 | {
18 | SqlWaitForAG SQLConfigureAG-WaitAGTest1
19 | {
20 | Name = 'AGTest1'
21 | RetryIntervalSec = 20
22 | RetryCount = 30
23 |
24 | PsDscRunAsCredential = $SqlAdministratorCredential
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Microsoft_Examples/WebAdministrationDsc/IisLogging/Sample_IisLogging_Rollover.ps1:
--------------------------------------------------------------------------------
1 | configuration Sample_IisLogging_Rollover
2 | {
3 | param
4 | (
5 | # Target nodes to apply the configuration
6 | [String[]] $NodeName = 'localhost'
7 | )
8 |
9 | # Import the module that defines custom resources
10 | Import-DscResource -Module WebAdministrationDsc
11 |
12 | Node $NodeName
13 | {
14 | IisLogging Logging
15 | {
16 | LogPath = 'C:\IISLogFiles'
17 | Logflags = @('Date', 'Time', 'ClientIP', 'UserName', 'ServerIP')
18 | LoglocalTimeRollover = $true
19 | LogPeriod = 'Hourly'
20 | LogFormat = 'W3C'
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/WebAdministrationDsc/IisLogging/Sample_IisLogging_Truncate.ps1:
--------------------------------------------------------------------------------
1 | configuration Sample_IisLogging_Truncate
2 | {
3 | param
4 | (
5 | # Target nodes to apply the configuration
6 | [String[]] $NodeName = 'localhost'
7 | )
8 |
9 | # Import the module that defines custom resources
10 | Import-DscResource -Module WebAdministrationDsc
11 |
12 | Node $NodeName
13 | {
14 | IisLogging Logging
15 | {
16 | LogPath = 'C:\IISLogFiles'
17 | Logflags = @('Date', 'Time', 'ClientIP', 'UserName', 'ServerIP')
18 | LoglocalTimeRollover = $true
19 | LogTruncateSize = '2097152'
20 | LogFormat = 'W3C'
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMClientSettingsDelivery/CMClientSettingsDelivery.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to modify client policy settings for delivery.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMClientSettingsDelivery DefaultAgent
12 | {
13 | SiteCode = 'Lab'
14 | Enable = $true
15 | ClientSettingName = 'Default Client Agent Settings'
16 | }
17 |
18 | CMClientSettingsDelivery DeviceAgent
19 | {
20 | SiteCode = 'Lab'
21 | Enable = $false
22 | ClientSettingName = 'ClientTest'
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/SCFilePlanPropertyCategory/1-AddingNewFilePlanPropertyCategory.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | SCFilePlanPropertyCategory 'FilePlanPropertyCategory'
18 | {
19 | Name = "My Category"
20 | Ensure = "Present"
21 | Credential = $credsGlobalAdmin
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/TeamsUpgradePolicy/1-AssignUsersToTeamsUpgradePolicy.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example demonstrates how to assign users to a Teams Upgrade Policy.
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobalAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | TeamsUpgradePolicy 'ConfigureIslandsPolicy'
17 | {
18 | Identity = 'Islands'
19 | Users = @("John.Smith@contoso.com", "Nik.Charlebois@contoso.com")
20 | MigrateMeetingsToTeams = $true
21 | Credential = $credsGlobalAdmin
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPVisioServiceApp/1-NewServiceApp.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to create a new visio services service app in the local farm
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPVisioServiceApp VisioServices
17 | {
18 | Name = 'Visio Graphics Service Application'
19 | ApplicationPool = 'SharePoint Web Services'
20 | PsDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlRS/1-DefaultConfiguration.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example performs a default SQL Server Reporting Services configuration.
4 | It will initialize SQL Server Reporting Services and register default
5 | Report Server Web Service and Report Manager URLs.
6 |
7 | Report Server Web Service: http://localhost:80/ReportServer
8 | Report Manager: http://localhost:80/Reports
9 | #>
10 | Configuration Example
11 | {
12 | Import-DscResource -ModuleName SqlServerDsc
13 |
14 | node localhost {
15 | SqlRS DefaultConfiguration
16 | {
17 | InstanceName = 'MSSQLSERVER'
18 | DatabaseServerName = 'localhost'
19 | DatabaseInstanceName = 'MSSQLSERVER'
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/SCFilePlanPropertyAuthority/1-AddingNewFilePlanPropertyCategory.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | SCFilePlanPropertyAuthority 'FilePlanPropertyAuthority'
18 | {
19 | Name = "My Authority"
20 | Ensure = "Present"
21 | Credential = $credsGlobalAdmin
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/SCRetentionEventType/1-AddingNewRetentionEventType.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | Node localhost
16 | {
17 | SCRetentionEventType 'RetentionEventType'
18 | {
19 | Name = "DemoEventType"
20 | Comment = "Demo event comment"
21 | Ensure = "Present"
22 | Credential = $credsGlobalAdmin
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/TeamsUser/1-AddUserToTeam.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | TeamsUser 'ConfigureTeamsUser'
18 | {
19 | TeamName = "SuperSecretTeam"
20 | User = "jdoe@contoso.com"
21 | Role = "Member"
22 | Ensure = "Present"
23 | Credential = $credsGlobalAdmin
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_Environment_CreateNonPathVariable.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Creates the environment variable 'TestEnvironmentVariable' and sets the value to 'TestValue'
4 | both on the machine and within the process.
5 | #>
6 | Configuration Sample_Environment_CreateNonPathVariable
7 | {
8 | param ()
9 |
10 | Import-DscResource -ModuleName 'PSDscResources'
11 |
12 | Node localhost
13 | {
14 | Environment CreateEnvironmentVariable
15 | {
16 | Name = 'TestEnvironmentVariable'
17 | Value = 'TestValue'
18 | Ensure = 'Present'
19 | Path = $false
20 | Target = @('Process', 'Machine')
21 | }
22 | }
23 | }
24 |
25 | Sample_Environment_CreateNonPathVariable
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPExcelServiceApp/1-CreateServiceApp.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to deploy Excel Services to the local SharePoint farm.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPExcelServiceApp ExcelServices
17 | {
18 | Name = 'Excel Services Service Application'
19 | ApplicationPool = 'SharePoint Service Applications'
20 | PsDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPSelfServiceSiteCreation/3-DisableSelfServiceSiteCreation.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to disable self-service site creation for a web application
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPSelfServiceSiteCreation SSC
17 | {
18 | WebAppUrl = 'http://example.contoso.local'
19 | Enabled = $false
20 | PsDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPWebAppPropertyBag/1-AddWebAppPropertyBag.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how add property bag value in a web application.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param
9 | (
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 |
15 | Import-DscResource -ModuleName SharePointDsc
16 |
17 | node localhost
18 | {
19 | SPWebAppPropertyBag APPLICATION_APPCodeProperty
20 | {
21 | PsDscRunAsCredential = $SetupAccount
22 | WebAppUrl = 'https://web.contoso.com'
23 | Key = 'KeyToAdd'
24 | Value = 'ValueToAddOrModify'
25 | Ensure = 'Present'
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/IntuneDeviceCompliancePolicyAndroidDeviceOwner/2-RemoveDeviceCompliancePolicyAndroidDeviceOwner.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example removes an existing Device Compliance Policy for Android Device Owner devices
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobalAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | IntuneDeviceCompliancePolicyAndroidDeviceOwner 'RemoveAndroidDeviceCompliancePolicyOwner'
17 | {
18 | DisplayName = "DeviceOwner"
19 | Ensure = "Absent"
20 | Credential = $credsGlobalAdmin
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/SCFilePlanPropertyDepartment/1-AddingNewFilePlanPropertyDepartment.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | Node localhost
16 | {
17 | SCFilePlanPropertyDepartment 'FilePlanPropertyDepartment'
18 | {
19 | Name = "Demo Department"
20 | Ensure = "Present"
21 | Credential = $credsGlobalAdmin
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPAppStoreSettings/2-EnableAppStores.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to configure the AppCatalog in the farm
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPAppStoreSettings EnableAppStores
17 | {
18 | WebAppUrl = 'https://sharepoint.contoso.com'
19 | AllowAppPurchases = $true
20 | AllowAppsForOffice = $true
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPInstallLanguagePack/1-InstallLanguagePack.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This module will install the SharePoint Language Pack. The binaries for
4 | SharePoint in this scenario are stored at C:\SPInstall (so it will look to run
5 | C:\SPInstall\Setup.exe)
6 | #>
7 |
8 | Configuration Example
9 | {
10 | param(
11 | [Parameter(Mandatory = $true)]
12 | [PSCredential]
13 | $SetupAccount
14 | )
15 | Import-DscResource -ModuleName SharePointDsc
16 |
17 | node localhost {
18 | SPInstallLanguagePack InstallLPBinaries
19 | {
20 | BinaryDir = 'C:\SPInstall'
21 | Ensure = 'Present'
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPProjectServerGroup/1-SpecificMembers.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to create a group with a specific list of members in a PWA site
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost
16 | {
17 | SPProjectServerGroup Group
18 | {
19 | Url = 'http://projects.contoso.com'
20 | Name = 'My group'
21 | Members = @(
22 | 'Domain\User1'
23 | 'Domain\User2'
24 | )
25 | PSDscRunAsCredential = $SetupAccount
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPStateServiceApp/1-Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example creates a state service application in the local farm
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPStateServiceApp StateServiceApp
17 | {
18 | Name = 'State Service Application'
19 | DatabaseName = 'SP_State'
20 | Ensure = 'Present'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/xDhcpServer/xDhcpServerReservation/xDhcpServerReservation.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSiS
3 | This example reservs an IP address within a DHCP server.
4 | #>
5 | configuration Example
6 | {
7 | Import-DscResource -ModuleName 'PSDscResources' -ModuleVersion '2.12.0.0'
8 | Import-DscResource -moduleName 'xDhcpServer'
9 |
10 | WindowsFeature 'DHCP'
11 | {
12 | Name = 'DHCP'
13 | Ensure = 'Present'
14 | }
15 |
16 | xDhcpServerReservation 'PullServerIP'
17 | {
18 | Ensure = 'Present'
19 | ScopeID = '192.168.1.0'
20 | ClientMACAddress = '00155D8A54A1'
21 | IPAddress = '192.168.1.2'
22 | Name = 'DSCPullServer'
23 | AddressFamily = 'IPv4'
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/IntuneDeviceCompliancePolicyAndroidWorkProfile/2-RemoveDeviceCompliancePolicyAndroidWorkProfile.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example removes an existing Device Compliance Policy for iOs devices
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobbaAdminlAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | IntuneDeviceCompliancePolicyAndroidWorkProfile 'RemoveDeviceCompliancePolicyAndroidWorkProfile'
17 | {
18 | DisplayName = "Test Android Work Profile Device Compliance Policy"
19 | Ensure = "Absent"
20 | Credential = $credsGlobalAdmin
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/SCFilePlanPropertyReferenceId/1-AddingNewFilePlanPropertyReferenceId.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | SCFilePlanPropertyReferenceId 'FilePlanPropertyReferenceId'
18 | {
19 | Name = "My Reference ID"
20 | Ensure = "Present"
21 | Credential = $credsGlobalAdmin
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPAppStoreSettings/3-DisableAppStores.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to configure the AppCatalog in the farm
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPAppStoreSettings DisableAppStores
17 | {
18 | WebAppUrl = 'https://sharepoint.contoso.com'
19 | AllowAppPurchases = $false
20 | AllowAppsForOffice = $false
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPDatabaseAAG/3-RemoveDBfromAAG.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example removes a database from the specified AlwaysOn Availability Group (AAG)
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPDatabaseAAG ConfigDBAAG
17 | {
18 | DatabaseName = 'SP_Config'
19 | AGName = 'MyAvailabilityGroup'
20 | Ensure = 'Absent'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPOfficeOnlineServerBinding/1-AddBinding.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to create bindings to the internal-https zone for the
4 | local SharePoint farm.
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPOfficeOnlineServerBinding OosBinding
18 | {
19 | Zone = 'internal-https'
20 | DnsName = 'webapps.contoso.com'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPServiceInstance/1-StartService.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to ensure that the managed metadata service is running
4 | on the local server.
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPServiceInstance ManagedMetadataServiceInstance
18 | {
19 | Name = 'Managed Metadata Web Service'
20 | Ensure = 'Present'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPSessionStateService/1-Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example creates a new session state service on the local farm.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPSessionStateService StateServiceApp
17 | {
18 | DatabaseName = 'SP_StateService'
19 | DatabaseServer = 'SQL.test.domain'
20 | Ensure = 'Present'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMClientSettingsMetered/CMClientSettingsMetered.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to modify client policy settings for metered network.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMClientSettingsMetered DefaultAgent
12 | {
13 | SiteCode = 'Lab'
14 | MeteredNetworkUsage = 'Block'
15 | ClientSettingName = 'Default Client Agent Settings'
16 | }
17 |
18 | CMClientSettingsMetered DeviceAgent
19 | {
20 | SiteCode = 'Lab'
21 | MeteredNetworkUsage = 'Allow'
22 | ClientSettingName = 'ClientTest'
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMForestDiscovery/ForestDiscovery_Enabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to enable AD Forest Discovery for Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMForestDiscovery ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | Enabled = $true
15 | ScheduleInterval = 'Days'
16 | ScheduleCount = 7
17 | EnableActiveDirectorySiteBoundaryCreation = $false
18 | EnableSubnetBoundaryCreation = $true
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/EXOAvailabilityConfig/1-ConfigureAvailabilityConfig.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param
9 | (
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $credsGlobalAdmin
13 | )
14 | Import-DscResource -ModuleName Microsoft365DSC
15 |
16 | node localhost
17 | {
18 | EXOAvailabilityConfig 'ConfigureAvailabilityConfig'
19 | {
20 | OrgWideAccount = "admin@contoso.onmicrosoft.com"
21 | Ensure = "Present"
22 | Credential = $credsGlobalAdmin
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPPerformancePointServiceApp/1-NewServiceApp.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example creates a new performance point service app in the local farm.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPPerformancePointServiceApp PerformancePoint
17 | {
18 | Name = 'Performance Point Service Application'
19 | ApplicationPool = 'SharePoint Web Services'
20 | PsDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/HyperVDsc/VhdFile/1-ChangeAttribute.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .DESCRIPTION
3 | Not yet written.
4 | #>
5 | Configuration Example
6 | {
7 | param
8 | (
9 | [Parameter()]
10 | $vhdPath = 'C:\temp\disk.vhdx',
11 |
12 | [Parameter()]
13 | $relativeDestinationPath = 'Temp',
14 |
15 | [Parameter()]
16 | [ValidateSet ('Archive', 'Hidden', 'ReadOnly', 'System' )]
17 | $attribute = 'Archive'
18 | )
19 |
20 | Import-DscResource -ModuleName 'HyperVDsc'
21 |
22 | VhdFile Change-Attribute
23 | {
24 | VhdPath = $vhdPath
25 | FileDirectory = DSC_FileDirectory
26 | {
27 | DestinationPath = $relativeDestinationPath
28 | Attributes = $attribute
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPServiceInstance/2-StopService.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to ensure that the Business Data Connectivity Service
4 | is not running on the local server.
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPServiceInstance StopBCSServiceInstance
18 | {
19 | Name = 'Business Data Connectivity Service'
20 | Ensure = 'Absent'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPAccess2010ServiceApp/1-CreateServiceApp.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to deploy Access Services 2010 to the local SharePoint farm.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPAccessServices2010 Access2010Services
17 | {
18 | Name = 'Access 2010 Services Service Application'
19 | ApplicationPool = 'SharePoint Service Applications'
20 | PsDscRunAsCredential = $SetupAccount
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/TeamsUpgradeConfiguration/1-ConfigureTeamsUpgradeConfiguration.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | TeamsUpgradeConfiguration 'ConfigureUpgradeConfig'
18 | {
19 | IsSingleInstance = "Yes"
20 | DownloadTeams = $True
21 | SfBMeetingJoinUx = "NativeLimitedClient"
22 | Credential = $credsGlobalAdmin
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPProjectServerServiceApp/1-NewServiceApp.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to create a new project server services service app
4 | in the local farm
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPProjectServerServiceApp ProjectServiceApp
18 | {
19 | Name = 'Project Server Service Application'
20 | ApplicationPool = 'SharePoint Web Services'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPServiceAppPool/1-Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example creates a service application pool for service apps to run in.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPServiceAppPool MainServiceAppPool
17 | {
18 | Name = 'SharePoint Service Applications'
19 | ServiceAccount = 'Demo\ServiceAccount'
20 | PsDscRunAsCredential = $SetupAccount
21 | Ensure = 'Present'
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/xDhcpServer/DhcpPolicyOptionValue/DhcpPolicyOptionValue_ServerLevel.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSiS
3 | This example sets an option ID 8 (cookie servers) on a policy at server level.
4 | #>
5 | configuration Example
6 | {
7 | Import-DscResource -ModuleName 'PSDscResources' -ModuleVersion '2.12.0.0'
8 | Import-DscResource -moduleName 'xDhcpServer'
9 |
10 | WindowsFeature 'DHCP'
11 | {
12 | Name = 'DHCP'
13 | Ensure = 'Present'
14 | }
15 |
16 | DhcpPolicyOptionValue 'PolicyOptionValue_ID-008'
17 | {
18 | OptionId = 8
19 | Value = '1.1.1.1'
20 | ScopeId = ''
21 | VendorClass = ''
22 | AddressFamily = 'IPv4'
23 | PolicyName = 'TestPolicy'
24 | Ensure = 'Present'
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/xDhcpServer/DhcpReservedIPOptionValue/DhcpReservedIPOptionValue.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSiS
3 | This example sets an option ID 8 (cookie servers) on a a reserved IP level.
4 | #>
5 | configuration Example
6 | {
7 | Import-DscResource -ModuleName 'PSDscResources' -ModuleVersion '2.12.0.0'
8 | Import-DscResource -moduleName 'xDhcpServer'
9 |
10 | WindowsFeature 'DHCP'
11 | {
12 | Name = 'DHCP'
13 | Ensure = 'Present'
14 | }
15 |
16 | DhcpReservedIPOptionValue 'ReservedIPOptionValue_ID-008'
17 | {
18 | ReservedIP = '192.168.0.1'
19 | OptionId = 8
20 | Value ='1.1.1.1'
21 | VendorClass = ''
22 | UserClass = ''
23 | AddressFamily = 'IPv4'
24 | Ensure = 'Present'
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMClientSettingsStateMessaging/CMClientSettingsStateMessaging.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to modify client policy settings for state messaging settings.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMClientSettingsStateMessaging DefaultAgent
12 | {
13 | SiteCode = 'Lab'
14 | ReportingCycleMins = 100
15 | ClientSettingName = 'Default Client Agent Settings'
16 | }
17 |
18 | CMClientSettingsStateMessaging DeviceAgent
19 | {
20 | SiteCode = 'Lab'
21 | ReportingCycleMins = 60
22 | ClientSettingName = 'ClientTest'
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/SPOHomeSite/1-ConfigureSPOHomeSite.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | SPOHomeSite 'SetMarketingSiteCollectionAsHomeSite'
18 | {
19 | IsSingleInstance = "Yes"
20 | Url = "https://contoso.sharepoint.com/sites/Marketing"
21 | Ensure = "Present"
22 | Credential = $credsGlobalAdmin
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/TeamsVoiceRoutingPolicy/1-AddNewVoiceRoutingPolicy.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example adds a new Teams Voice Routing Policy.
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobalAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | TeamsVoiceRoutingPolicy 'ConfigureVoiceRoutingPolicy'
17 | {
18 | Identity = 'NewVoiceRoutingPolicy'
19 | OnlinePstnUsages = @('Long Distance', 'Local', 'Internal')
20 | Description = 'This is a sample Voice Routing Policy'
21 | Ensure = 'Present'
22 | Credential = $credsGlobalAdmin
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPWorkflowService/1-RegisterWorkflowService.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example registers the workflow service over http.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPWorkflowService WorkflowService
17 | {
18 | WorkflowHostUri = 'http://workflow.sharepoint.contoso.com'
19 | SPSiteUrl = 'http://sites.sharepoint.com'
20 | AllowOAuthHttp = $true
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/HyperVDsc/VMNetworkAdapter/4-MultipleVMMACAddress.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .DESCRIPTION
3 | Description not yet written.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName 'HyperVDsc' -Name VMNetworkAdapter
8 | Import-DscResource -ModuleName PSDesiredStateConfiguration
9 |
10 | VMNetworkAdapter MyVM01NIC {
11 | Id = 'MyVM01-NIC'
12 | Name = 'MyVM01-NIC'
13 | SwitchName = 'SETSwitch'
14 | MacAddress = '001523be0c00'
15 | VMName = 'MyVM01'
16 | Ensure = 'Present'
17 | }
18 |
19 | VMNetworkAdapter MyVM02NIC {
20 | Id = 'MyVM02-NIC'
21 | Name = 'MyVM02-NIC'
22 | SwitchName = 'SETSwitch'
23 | MacAddress = '001523be0c00'
24 | VMName = 'MyVM02'
25 | Ensure = 'Present'
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/SPOPropertyBag/1-AddNewPropertyBagKey.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | SPOPropertyBag 'ConfigurePropertyBag'
18 | {
19 | Url = "https://contoso.sharepoint.com/sites/Marketing"
20 | Key = "MyKey"
21 | Value = "MyValue"
22 | Ensure = "Present"
23 | Credential = $credsGlobalAdmin
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPAntivirusSettings/1-SetAntivirusConfig.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to apply specific anti-virus configuration to the farm
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPAntivirusSettings AVSettings
17 | {
18 | IsSingleInstance = 'Yes'
19 | ScanOnDownload = $true
20 | ScanOnUpload = $true
21 | AllowDownloadInfected = $false
22 | AttemptToClean = $false
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPFarmAdministrators/1-SetSpecificAdmins.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to set a specific list of members for the farm admins group.
4 | Any members not in this list will be removed.
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPFarmAdministrators LocalFarmAdmins
18 | {
19 | IsSingleInstance = 'Yes'
20 | Members = @('CONTOSO\user1', 'CONTOSO\user2')
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPQuotaTemplate/1-Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example creates a specific quota template in the local farm.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPQuotaTemplate TeamsiteTemplate
17 | {
18 | Name = 'Teamsite'
19 | StorageMaxInMB = 1024
20 | StorageWarningInMB = 512
21 | MaximumUsagePointsSolutions = 1000
22 | WarningUsagePointsSolutions = 800
23 | Ensure = 'Present'
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPRemoteFarmTrust/1-Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example creates a remote farm trust so that the local web app trusts calls
4 | that will come from the remote web app.
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPRemoteFarmTrust TrustRemoteFarmForSearch
18 | {
19 | Name = 'CentralSearchFarm'
20 | RemoteWebAppUrl = 'https://search.sharepoint.contoso.com'
21 | LocalWebAppUrl = 'https://local.sharepoint2.contoso.com'
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPSearchServiceApp/1-NewServiceApp.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example creates a new search service app in the local farm
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPSearchServiceApp SearchServiceApp
17 | {
18 | Name = 'Search Service Application'
19 | DatabaseName = 'SP_Search'
20 | ApplicationPool = 'SharePoint Service Applications'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPIncomingEmailSettings/1-EnableAutomaticMode.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to configure SharePoint Incoming Email in Automatic Mode
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPIncomingEmailSettings AutomaticEmail
17 | {
18 | IsSingleInstance = 'Yes'
19 | Ensure = 'Present'
20 | UseAutomaticSettings = $true
21 | UseDirectoryManagementService = 'No'
22 | ServerDisplayAddress = 'contoso.com'
23 | PsDscRunAsCredential = $SetupAccount
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPInstallPrereqs/1-OnlineInstall.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This module will install the prerequisites for SharePoint. This resource will run in
4 | online mode, looking to download all prerequisites from the internet.
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPInstallPrereqs InstallPrerequisites
18 | {
19 | IsSingleInstance = 'Yes'
20 | InstallerPath = 'C:\SPInstall\Prerequisiteinstaller.exe'
21 | OnlineMode = $true
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPPublishServiceApplication/2-UnpublishServiceApplication.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to ensure that the Secure Store Service is not
4 | published within the farm.
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPPublishServiceApplication UnpublishSecureStoreServiceApp
18 | {
19 | Name = 'Secure Store Service Application'
20 | Ensure = 'Absent'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPTrustedRootAuthority/2-AddRootAuthorityCertInFilePath.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example deploys a SP Trusted Root Authority to the local farm.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPTrustedRootAuthority SampleRootAuthority
17 | {
18 | Name = 'Contoso'
19 | CertificateFilePath = 'C:\Certificates\RootAuthority.cer'
20 | Ensure = 'Present'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlDatabase/2-DeleteDatabase.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to remove a database with
4 | the database name equal to 'AdventureWorks'.
5 | #>
6 | Configuration Example
7 | {
8 | param
9 | (
10 | [Parameter(Mandatory = $true)]
11 | [System.Management.Automation.PSCredential]
12 | $SqlAdministratorCredential
13 | )
14 |
15 | Import-DscResource -ModuleName SqlServerDsc
16 |
17 | node localhost
18 | {
19 | SqlDatabase Delete_Database
20 | {
21 | Ensure = 'Absent'
22 | ServerName = 'sqltest.company.local'
23 | InstanceName = 'DSC'
24 | Name = 'AdventureWorks'
25 |
26 | PsDscRunAsCredential = $SqlAdministratorCredential
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Microsoft_Examples/xDhcpServer/DhcpPolicyOptionValue/DhcpPolicyOptionValue_ScopeLevel.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSiS
3 | This example sets an option ID 8 (cookie servers) on a policy at scope level.
4 | #>
5 | configuration Example
6 | {
7 | Import-DscResource -ModuleName 'PSDscResources' -ModuleVersion '2.12.0.0'
8 | Import-DscResource -moduleName 'xDhcpServer'
9 |
10 | WindowsFeature 'DHCP'
11 | {
12 | Name = 'DHCP'
13 | Ensure = 'Present'
14 | }
15 |
16 | DhcpPolicyOptionValue 'PolicyOptionValue_ID-008-scope'
17 | {
18 | OptionId = 8
19 | Value = '1.1.1.1'
20 | ScopeId = '192.168.0.0'
21 | VendorClass = ''
22 | AddressFamily = 'IPv4'
23 | PolicyName = 'TestPolicy'
24 | Ensure = 'Present'
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMAssetIntelligencePoint/CMAssetIntelligencePoint_Present.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to add an asset intelligence synchronization point to Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMAssetIntelligencePoint ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SiteServerName = 'CA01.contoso.com'
15 | Ensure = 'Present'
16 | ScheduleType = 'Days'
17 | RecurInterval = '7'
18 | Enable = $True
19 | EnableSynchronization = $True
20 | IsSingleInstance = 'Yes'
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMSiteMaintenance/CMSiteMaintenance_MaintenanceTask_Enabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to enable Delete Aged Client Operations maintenance task.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | Import-DscResource -ModuleName ConfigMgrCBDsc
9 |
10 | Node localhost
11 | {
12 | CMSiteMaintenance MaintenanceTask
13 | {
14 | SiteCode = 'Lab'
15 | TaskName = 'Delete Aged Client Operations'
16 | Enabled = $true
17 | DaysOfWeek = @('Saturday','Friday','Thursday','Wednesday','Tuesday','Monday','Sunday')
18 | BeginTime = '0100'
19 | LatestBeginTime = '0500'
20 | DeleteOlderThanDays = 30
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/IntuneDeviceEnrollmentLimitRestriction/1-New Device Enrollment Limit Restriction.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example creates a new Device Enrollment Limit Restriction.
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobalAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | IntuneDeviceEnrollmentLimitRestriction 'DeviceEnrollmentLimitRestriction'
17 | {
18 | Description = "My Restriction"
19 | DisplayName = "My DSC Limit"
20 | Limit = 12
21 | Ensure = "Present"
22 | Credential = $credsGlobalAdmin
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/PlannerTask/1-NewPlannerTask.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example creates a new Planner Task in a Plan.
3 | #>
4 |
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName Microsoft365DSC
8 |
9 | node localhost
10 | {
11 | PlannerTask 'ContosoPlannerTask'
12 | {
13 | PlanId = "1234567890"
14 | Title = "Contoso Task"
15 | StartDateTime = "2020-06-09"
16 | Priority = 7
17 | PercentComplete = 75
18 | Ensure = "Present"
19 | ApplicationId = "12345-12345-12345-12345-12345"
20 | TenantId = "12345-12345-12345-12345-12345"
21 | CertificateThumbprint = "1234567890"
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPPublishServiceApplication/1-PublishServiceApplication.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to ensure that the managed metadata service is published
4 | within the farm.
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPPublishServiceApplication PublishManagedMetadataServiceApp
18 | {
19 | Name = 'Managed Metadata Service Application'
20 | Ensure = 'Present'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPTrustedRootAuthority/3-RemoveRootAuthority.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example removes a SP Trusted Root Authority from the local farm.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPTrustedRootAuthority SampleRootAuthority
17 | {
18 | Name = 'Contoso'
19 | CertificateThumbprint = '770515261D1AB169057E246E0EE6431D557C3AFB'
20 | Ensure = 'Absent'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPWebAppBlockedFileTypes/2-SpecificList.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to ensure that the blocked file type list always
4 | specifically matches this list.
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPWebAppBlockedFileTypes PrimaryWebAppBlockedFileTypes
18 | {
19 | WebAppUrl = 'http://example.contoso.local'
20 | Blocked = @('exe', 'dll', 'msi')
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/O365AdminAuditLogConfig/1-ConfigureAuditLog.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | O365AdminAuditLogConfig 'AuditLogConfig'
18 | {
19 | IsSingleInstance = "Yes"
20 | UnifiedAuditLogIngestionEnabled = "Enabled"
21 | Ensure = "Present"
22 | Credential = $credsGlobalAdmin
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/SCComplianceCase/1-AddingNewComplianceCase.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | SCComplianceCase 'ConfigureComplianceCase'
18 | {
19 | Name = "MyCase"
20 | Description = "MyPolicy"
21 | Status = "Active"
22 | Ensure = "Present"
23 | Credential = $credsGlobalAdmin
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/TeamsFederationConfiguration/1-ConfigureTeamsFederation.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This examples sets the Teams Federation Configuration.
3 | #>
4 |
5 | Configuration Example
6 | {
7 | param(
8 | [Parameter(Mandatory = $true)]
9 | [PSCredential]
10 | $credsGlobalAdmin
11 | )
12 | Import-DscResource -ModuleName Microsoft365DSC
13 |
14 | node localhost
15 | {
16 | TeamsFederationConfiguration 'FederationConfiguration'
17 | {
18 | Identity = "Global"
19 | AllowFederatedUsers = $True
20 | AllowPublicUsers = $True
21 | AllowTeamsConsumer = $False
22 | AllowTeamsConsumerInbound = $False
23 | Credential = $credsGlobalAdmin
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPDatabaseAAG/1-AddDBtoAAG.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example takes an existing SharePoint database and puts it in to the specified
4 | AlwaysOn Availability Group (AAG).
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPDatabaseAAG ConfigDBAAG
18 | {
19 | DatabaseName = 'SP_Config'
20 | AGName = 'MyAvailabilityGroup'
21 | FileShare = '\\SQL\Backups'
22 | PsDscRunAsCredential = $SetupAccount
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/AuditPolicyDsc/Sample_AuditPolicyGuid.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example will set the Logon Success and Failure flags on the localhost.
3 | To use this example, run it using PowerShell.
4 | #>
5 | Configuration Sample_AuditPolicyGuid
6 | {
7 | param
8 | (
9 | [String] $NodeName = 'localhost'
10 | )
11 |
12 | Import-DscResource -ModuleName AuditPolicyDsc
13 |
14 | Node $NodeName
15 | {
16 | AuditPolicyGuid LogonSuccess
17 | {
18 | Name = 'Logon'
19 | AuditFlag = 'Success'
20 | Ensure = 'Absent'
21 | }
22 |
23 | AuditPolicyGuid LogonFailure
24 | {
25 | Name = 'Logon'
26 | AuditFlag = 'Failure'
27 | Ensure = 'Present'
28 | }
29 | }
30 | }
31 |
32 | Sample_AuditPolicyGuid
33 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/EXOPerimeterConfiguration/1-ConfigurePerimeterConfiguration.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param
9 | (
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $credsGlobalAdmin
13 | )
14 | Import-DscResource -ModuleName Microsoft365DSC
15 |
16 | node localhost
17 | {
18 | EXOPerimeterConfiguration 'ConfigurePerimeterConfiguration'
19 | {
20 | Identity = "Global"
21 | GatewayIPAddresses = "123.0.0.1"
22 | Ensure = "Present"
23 | Credential = $credsGlobalAdmin
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/SCSupervisoryReviewPolicy/1-AddingNewSupervisoryReviewPolicy.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | Node localhost
16 | {
17 | SCSupervisoryReviewPolicy 'SupervisoryReviewPolicy'
18 | {
19 | Name = "MyPolicy"
20 | Comment = "Test Policy"
21 | Reviewers = @("admin@contoso.com")
22 | Ensure = "Present"
23 | Credential = $credsGlobalAdmin
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_Group_SetMembers.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | If the group named GroupName1 does not exist, creates a group named GroupName1 and adds the
4 | users with the usernames Username1 and Username2 to the group.
5 |
6 | If the group named GroupName1 already exists, removes any users that do not have the
7 | usernames Username1 or Username2 from the group and adds the users that have the usernames
8 | Username1 and Username2 to the group.
9 | #>
10 | Configuration Sample_Group_SetMembers
11 | {
12 | [CmdletBinding()]
13 | param ()
14 |
15 | Import-DscResource -ModuleName 'PSDscResources'
16 |
17 | Group Group1
18 | {
19 | GroupName = 'GroupName1'
20 | Ensure = 'Present'
21 | Members = @( 'Username1', 'Username2' )
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPProjectServerTimesheetSettings/1-Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example demonstrates how to apply timesheet settings to a specific
4 | PWA instance
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost
17 | {
18 | SPProjectServerTimeSheetSettings ConfigureTimeSheets
19 | {
20 | Url = 'http://projects.contoso.com/pwa'
21 | HoursInStandardDay = 8
22 | HoursInStandardWeek = 40
23 | AllowFutureTimeReporting = $false
24 | PsDscRunAsCredential = $SetupAccount
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPTrustedRootAuthority/1-AddRootAuthorityCertInCertStore.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example deploys a SP Trusted Root Authority to the local farm.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPTrustedRootAuthority SampleRootAuthority
17 | {
18 | Name = 'Contoso'
19 | CertificateThumbprint = '770515261D1AB169057E246E0EE6431D557C3AFB'
20 | Ensure = 'Present'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/SPOBrowserIdleSignout/1-ConfigureSPOSPOBrowserIdleSignout.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | SPOBrowserIdleSignout 'ConfigureBrowserIdleSignout'
18 | {
19 | IsSingleInstance = "Yes"
20 | Enabled = $True
21 | SignOutAfter = "04:00:00"
22 | WarnAfter = "03:30:00"
23 | Credential = $Credsglobaladmin
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/SPOSiteDesignRights/1-AssignDesignRights.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | SPOSiteDesignRights 'ConfigureSiteDesignRights'
18 | {
19 | SiteDesignTitle = "Customer List"
20 | UserPrincipals = "jdoe@contoso.onmicrosoft.com"
21 | Rights = "View"
22 | Ensure = "Present"
23 | Credential = $credsGlobalAdmin
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPConfigWizard/2-RunConfigWizardInWindow.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example only runs the Configuration Wizard in the specified window:
4 | - Saturday and Sunday night between 3am and 5am.
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPConfigWizard RunConfigWizard
18 | {
19 | IsSingleInstance = 'Yes'
20 | DatabaseUpgradeDays = 'sat', 'sun'
21 | DatabaseUpgradeTime = '3:00am to 5:00am'
22 | PsDscRunAsCredential = $SetupAccount
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPFeature/1-EnableFeature.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to enable a site collection scoped feature
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPFeature EnableViewFormsLockDown
17 | {
18 | Name = 'ViewFormPagesLockDown'
19 | Url = 'http://www.contoso.com'
20 | FeatureScope = 'Site'
21 | PsDscRunAsCredential = $SetupAccount
22 | Version = '1.0.0.0'
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPInstall/1-InstallToDefaultPath.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This module will install SharePoint to the default locations. The binaries for
4 | SharePoint in this scenario are stored at C:\SPInstall (so it will look to run
5 | C:\SPInstall\Setup.exe)
6 | #>
7 |
8 | Configuration Example
9 | {
10 | param(
11 | [Parameter(Mandatory = $true)]
12 | [PSCredential]
13 | $SetupAccount
14 | )
15 | Import-DscResource -ModuleName SharePointDsc
16 |
17 | node localhost {
18 | SPInstall InstallBinaries
19 | {
20 | IsSingleInstance = 'Yes'
21 | BinaryDir = 'C:\SPInstall'
22 | ProductKey = 'XXXXX-XXXXX-XXXXX-XXXXX-XXXXX'
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPManagedPath/2-WildcardPath.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to add a wildcard managed path to a specific web application
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPManagedPath TestManagedPath
17 | {
18 | WebAppUrl = 'http://sharepoint.contoso.com'
19 | RelativeUrl = 'teams'
20 | Explicit = $false
21 | HostHeader = $true
22 | PsDscRunAsCredential = $SetupAccount
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPOfficeOnlineServerBinding/2-RemoveBinding.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to remove bindings from the internal-http zone for the
4 | local SharePoint farm.
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPOfficeOnlineServerBinding OosBinding
18 | {
19 | Zone = 'Internal-HTTP'
20 | DnsName = 'webapps.contoso.com'
21 | PsDscRunAsCredential = $SetupAccount
22 | Ensure = 'Absent'
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPSiteUrl/1-Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example configures the site collection urls for the specified
4 | Host Named Site Collection
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPSiteUrl TeamSite
18 | {
19 | Url = 'http://sharepoint.contoso.intra'
20 | Intranet = 'http://sharepoint.contoso.com'
21 | Internet = 'https://sharepoint.contoso.com'
22 | PsDscRunAsCredential = $SetupAccount
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPWebApplicationAppDomain/1-Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to set the app domain for a specified web application
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPWebApplicationAppDomain Domain
17 | {
18 | AppDomain = 'contosointranetapps.com'
19 | WebAppUrl ='http://portal.contoso.com';
20 | Zone = 'Default';
21 | Port = 80;
22 | SSL = $false;
23 | PsDscRunAsCredential = $SetupAccount
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlServerMaxDop/3-SetMaxDopToDefault.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to set max degree of parallelism server
4 | configuration option with the default configuration.
5 | #>
6 | Configuration Example
7 | {
8 | param
9 | (
10 | [Parameter(Mandatory = $true)]
11 | [System.Management.Automation.PSCredential]
12 | $SqlAdministratorCredential
13 | )
14 |
15 | Import-DscResource -ModuleName SqlServerDsc
16 |
17 | node localhost
18 | {
19 | SqlServerMaxDop Set_SQLServerMaxDop_ToDefault
20 | {
21 | Ensure = 'Absent'
22 | ServerName = 'sqltest.company.local'
23 | InstanceName = 'DSC'
24 | PsDscRunAsCredential = $SqlAdministratorCredential
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlServerMemory/4-SetMaxMemoryToDefault.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to set the minimum and maximum memory
4 | configuration option with the default configuration.
5 | #>
6 | Configuration Example
7 | {
8 | param
9 | (
10 | [Parameter(Mandatory = $true)]
11 | [System.Management.Automation.PSCredential]
12 | $SqlAdministratorCredential
13 | )
14 |
15 | Import-DscResource -ModuleName SqlServerDsc
16 |
17 | node localhost
18 | {
19 | SqlServerMemory Set_SQLServerMaxMemory_ToDefault
20 | {
21 | Ensure = 'Absent'
22 | ServerName = 'sqltest.company.local'
23 | InstanceName = 'DSC'
24 | PsDscRunAsCredential = $SqlAdministratorCredential
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Microsoft_Examples/PSDscResources/Sample_GroupSet_AddMembers.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | If the groups named GroupName1 and Administrators do not exist, creates the groups named
4 | GroupName1 and Administrators and adds the users with the usernames Username1 and Username2
5 | to both groups.
6 |
7 | If the groups named GroupName1 and Administrators already exist, adds the users with the
8 | usernames Username1 and Username2 to both groups.
9 | #>
10 | Configuration Sample_GroupSet_AddMembers
11 | {
12 | [CmdletBinding()]
13 | param ()
14 |
15 | Import-DscResource -ModuleName 'PSDscResources'
16 |
17 | GroupSet GroupSet
18 | {
19 | GroupName = @( 'Administrators', 'GroupName1' )
20 | Ensure = 'Present'
21 | MembersToInclude = @( 'Username1', 'Username2' )
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPManagedPath/1-ExplicitPath.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to deploy an explicit managed path to a specifici web application
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPManagedPath TestManagedPath
17 | {
18 | WebAppUrl = 'http://sharepoint.contoso.com'
19 | RelativeUrl = 'example'
20 | Explicit = $true
21 | HostHeader = $false
22 | PsDscRunAsCredential = $SetupAccount
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPSearchCrawlerImpactRule/2 - WaitTime:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to create a Crawler Impact Rule with a Wait Time
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPSearchCrawlerImpactRule IntranetCrawlerImpactWaitTimeRule
17 | {
18 | ServiceAppName = 'Search Service Application'
19 | Name = 'https://intranet.sharepoint.contoso.com'
20 | WaitTime = 60
21 | Ensure = 'Present'
22 | PsDscRunAsCredential = $SetupAccount
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlServerSecureConnection/4-SecureConnectionUsingSYSTEMAccount.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example performs a standard Sql encryption setup using the 'SYSTEM' account.
4 | Note that the 'LocalSystem' account should not be used because it returns a connection error,
5 | even though it inherits the 'SYSTEM' account's privileges.
6 | #>
7 | Configuration Example
8 | {
9 | Import-DscResource -ModuleName SqlServerDsc
10 |
11 | node localhost {
12 | SqlServerSecureConnection SecureConnectionUsingSYSTEMAccount
13 | {
14 | InstanceName = 'MSSQLSERVER'
15 | Thumbprint = 'fb0b82c94b80da26cf0b86f10ec0c50ae7864a2c'
16 | ForceEncryption = $false
17 | Ensure = 'Present'
18 | ServiceAccount = 'SYSTEM'
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlServiceAccount/1-ConfigureServiceAccount-UserAccount.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to ensure the SQL Server service
4 | on TestServer is running under a user account.
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [System.Management.Automation.PSCredential]
12 | $ServiceAccountCredential
13 | )
14 |
15 | Import-DscResource -ModuleName SqlServerDsc
16 |
17 | Node localhost {
18 | SqlServiceAccount SetServiceAccount_User
19 | {
20 | ServerName = 'TestServer'
21 | InstanceName = 'MSSQLSERVER'
22 | ServiceType = 'DatabaseEngine'
23 | ServiceAccount = $ServiceAccountCredential
24 | RestartService = $true
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Microsoft_Examples/xExchange/WaitForADPrep/WaitForADPrep.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to ensure that the ADPrep already exists.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | [CmdletBinding()]
9 | param
10 | (
11 | [Parameter(Mandatory = $true)]
12 | [ValidateNotNullorEmpty()]
13 | [System.Management.Automation.PSCredential]
14 | $ExchangeAdminCredential
15 | )
16 |
17 | Import-DscResource -Module xExchange
18 |
19 | node localhost
20 | {
21 | xExchWaitForADPrep WaitForADPrep
22 | {
23 | Identity = 'Doesn'tMatter'
24 | Credential = $ExchangeAdminCredential
25 | SchemaVersion = 15303
26 | OrganizationVersion = 15965
27 | DomainVersion = 13236
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlServerConfiguration/2-ConfigureInstanceToEnablePriorityBoost.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to configure two SQL Server instances on the same server to have the setting 'priority boost' enabled.
4 | .NOTES
5 | To get all available options run sp_configure on the SQL Server instance, or refer to https://msdn.microsoft.com/en-us/library/ms189631.aspx
6 | #>
7 |
8 | Configuration Example
9 | {
10 | Import-DscResource -ModuleName SqlServerDsc
11 |
12 | node localhost
13 | {
14 | SqlServerConfiguration 'SQLConfigPriorityBoost'
15 | {
16 |
17 | ServerName = 'localhost'
18 | InstanceName = 'MSSQLSERVER'
19 | OptionName = 'priority boost'
20 | OptionValue = 1
21 | RestartService = $false
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMEmailNotificationComponent/CMEmailNotificationComponent_Present.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to enable email notification component in Configuration Manager.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMEmailNotificationComponent ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | SendFrom = 'emailsender@contoso.com'
15 | SmtpServerFqdn = 'EmailServer.contoso.com'
16 | TypeOfAuthentication = 'Other'
17 | Port = 465
18 | UseSsl = $true
19 | Enabled = $true
20 | UserName = 'contoso\EmailUser'
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPServiceIdentity/1-Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to set the SandBox Code Service to run under a specifed service account.
4 | The account must already be registered as a managed account.
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 |
15 | Import-DscResource -ModuleName SharePointDsc
16 |
17 | node localhost {
18 |
19 | SPServiceIdentity SandBoxUserAccount
20 | {
21 | Name = 'Microsoft SharePoint Foundation Sandboxed Code Service'
22 | ManagedAccount = 'CONTOSO\SPUserCode'
23 | PsDscRunAsCredential = $SetupAccount
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlScriptQuery/1-RunScriptUsingSQLAuthentication.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to run SQL script using SQL Authentication.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [System.Management.Automation.PSCredential]
11 | $SqlCredential
12 | )
13 |
14 | Import-DscResource -ModuleName SqlServerDsc
15 |
16 | Node localhost
17 | {
18 | SqlScriptQuery 'RunAsSqlCredential'
19 | {
20 | ServerInstance = 'localhost\SQL2016'
21 | Credential = $SqlCredential
22 |
23 | SetQuery = 'Set query'
24 | TestQuery = 'Test query'
25 | GetQuery = 'Get query'
26 | Variable = @('FilePath=C:\temp\log\AuditFiles')
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Microsoft_Examples/AuditPolicyDsc/Sample_AuditPolicySubcategory.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example will set the Logon Success and Failure flags on the localhost.
3 | To use this example, run it using PowerShell.
4 | #>
5 | Configuration Sample_AuditSubcategory
6 | {
7 | param
8 | (
9 | [String] $NodeName = 'localhost'
10 | )
11 |
12 | Import-DscResource -ModuleName AuditPolicyDsc
13 |
14 | Node $NodeName
15 | {
16 | AuditPolicySubcategory LogonSuccess
17 | {
18 | Name = 'Logon'
19 | AuditFlag = 'Success'
20 | Ensure = 'Absent'
21 | }
22 |
23 | AuditPolicySubcategory LogonFailure
24 | {
25 | Name = 'Logon'
26 | AuditFlag = 'Failure'
27 | Ensure = 'Present'
28 | }
29 | }
30 | }
31 |
32 | Sample_AuditSubcategory
33 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMUserDiscovery/CMUserDiscovery_ScheduleNone.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to user discovery set to a custom schedule to none.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMUserDiscovery ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | Enabled = $true
15 | ScheduleInterval = 'None'
16 | EnableDeltaDiscovery = $true
17 | DeltaDiscoveryMins = 50
18 | ADContainers = @(
19 | 'LDAP://OU=Far,DC=contoso,DC=com','LDAP://OU=Far,OU=Domain Controllers,DC=contoso,DC=com',
20 | 'LDAP://OU=Far,OU=Deployables,DC=contoso,DC=com'
21 | )
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPAccessServiceApp/1-CreateServiceApp.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to deploy Access Services 2013 to the local SharePoint farm.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPAccessServiceApp AccessServices
17 | {
18 | Name = 'Access Services Service Application'
19 | ApplicationPool = 'SharePoint Service Applications'
20 | DatabaseServer = 'SQL.contoso.local\SQLINSTANCE'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPSearchCrawlerImpactRule/1 - RequestLimit:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to create a Crawler Impact Rule with a Request Limit
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPSearchCrawlerImpactRule IntranetCrawlerImpactRequestLimitRule
17 | {
18 | ServiceAppName = 'Search Service Application'
19 | Name = 'https://intranet.sharepoint.contoso.com'
20 | RequestLimit = 8
21 | Ensure = 'Present'
22 | PsDscRunAsCredential = $SetupAccount
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPWorkManagementServiceApp/1-Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example creates a new work management service app in the local farm
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPWorkManagementServiceApp WorkManagementServiceApp
17 | {
18 | Name = 'Work Management Service Application'
19 | ApplicationPool = 'SharePoint web services'
20 | MinimumTimeBetweenEwsSyncSubscriptionSearches = 10
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/TeamsGuestMeetingConfiguration/1-ConfigureTeamsGuestMeeting.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | TeamsGuestMeetingConfiguration 'TeamsGuestMeetingConfiguration'
18 | {
19 | Identity = "Global"
20 | AllowIPVideo = $True
21 | AllowMeetNow = $True
22 | ScreenSharingMode = "EntireScreen"
23 | Credential = $credsGlobalAdmin
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPSearchFileType/1-EnsureFileType.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to apply settings to a specific file type in search, using the required parameters
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPSearchFileType PDF
17 | {
18 | FileType = 'pdf'
19 | ServiceAppName = 'Search Service Application'
20 | Description = 'PDF'
21 | MimeType = 'application/pdf'
22 | Ensure = 'Present'
23 | PsDscRunAsCredential = $SetupAccount
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPSearchFileType/2-DisableFileType.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to disable a specific file type in search
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPSearchFileType PDF
17 | {
18 | FileType = 'pdf'
19 | ServiceAppName = 'Search Service Application'
20 | Description = 'PDF'
21 | MimeType = 'application/pdf'
22 | Enabled = $false
23 | Ensure = 'Present'
24 | PsDscRunAsCredential = $SetupAccount
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlAlwaysOnService/1-EnableAlwaysOn.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to enable SQL Server Always On high availability and
4 | disaster recovery (HADR).
5 | #>
6 | Configuration Example
7 | {
8 | param
9 | (
10 | [Parameter(Mandatory = $true)]
11 | [System.Management.Automation.PSCredential]
12 | $SqlAdministratorCredential
13 | )
14 |
15 | Import-DscResource -ModuleName SqlServerDsc
16 |
17 | node localhost
18 | {
19 | SqlAlwaysOnService 'EnableAlwaysOn'
20 | {
21 | Ensure = 'Present'
22 | ServerName = 'SP23-VM-SQL1'
23 | InstanceName = 'MSSQLSERVER'
24 | RestartTimeout = 120
25 |
26 | PsDscRunAsCredential = $SqlAdministratorCredential
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SqlServerDsc/SqlAlwaysOnService/2-DisableAlwaysOn.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to disable SQL Server Always On high availability and
4 | disaster recovery (HADR).
5 | #>
6 | Configuration Example
7 | {
8 | param
9 | (
10 | [Parameter(Mandatory = $true)]
11 | [System.Management.Automation.PSCredential]
12 | $SqlAdministratorCredential
13 | )
14 |
15 | Import-DscResource -ModuleName SqlServerDsc
16 |
17 | node localhost
18 | {
19 | SqlAlwaysOnService 'DisableAlwaysOn'
20 | {
21 | Ensure = 'Absent'
22 | ServerName = 'SP23-VM-SQL1'
23 | InstanceName = 'MSSQLSERVER'
24 | RestartTimeout = 120
25 |
26 | PsDscRunAsCredential = $SqlAdministratorCredential
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/SPOSearchResultSource/1-CreateNewResultSource.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | SPOSearchResultSource 'ConfigureSearchResultSource'
18 | {
19 | Name = "MyResultSource"
20 | Description = "Description of item"
21 | Protocol = "Local"
22 | Type = "SharePoint"
23 | Ensure = "Present"
24 | Credential = $credsGlobalAdmin
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPHealthAnalyzerRuleState/1-DisableHealthRule.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example shows how to disable a health analyzer rule
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPHealthAnalyzerRuleState DisableDiskSpaceRule
17 | {
18 | Name = 'Drives are at risk of running out of free space.'
19 | Enabled = $false
20 | RuleScope = 'All Servers'
21 | Schedule = 'Daily'
22 | FixAutomatically = $false
23 | PsDscRunAsCredential = $SetupAccount
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPProjectServerUserSyncSettings/1-Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example demonstrates how to set user sync settings for a PWA site
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost
16 | {
17 | SPProjectServerUserSyncSettings UserSyncSettings
18 | {
19 | Url = 'http://projects.contoso.com/pwa'
20 | EnableProjectWebAppSync = $true
21 | EnableProjectSiteSync = $true
22 | EnableProjectSiteSyncForSPTaskLists = $true
23 | PsDscRunAsCredential = $SetupAccount
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPSearchIndexPartition/1-Example.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example adds an extra search partition to the local farms topology
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $SetupAccount
12 | )
13 | Import-DscResource -ModuleName SharePointDsc
14 |
15 | node localhost {
16 | SPSearchIndexPartition AdditionalPartition
17 | {
18 | Servers = @('Server2', 'Server3')
19 | Index = 1
20 | RootDirectory = 'I:\SearchIndexes\1'
21 | ServiceAppName = 'Search Service Application'
22 | PsDscRunAsCredential = $SetupAccount
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPWebAppSuiteBar/2-ApplySuiteBarBranding2013.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example sets the branding for the suite bar of a given
4 | Web Application in SharePoint 2013.
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPWebAppSuiteBar SP2013Branding
18 | {
19 | WebAppUrl = 'https://intranet.sharepoint.contoso.com'
20 | SuiteBarBrandingElementHtml = '
SharePointDSC WebApp
'
21 | PsDscRunAsCredential = $SetupAccount
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/CMUserDiscovery/CMUserDiscovery_Enabled.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | A DSC configuration script to set user discovery enabled.
4 | #>
5 | Configuration Example
6 | {
7 | Import-DscResource -ModuleName ConfigMgrCBDsc
8 |
9 | Node localhost
10 | {
11 | CMUserDiscovery ExampleSettings
12 | {
13 | SiteCode = 'Lab'
14 | Enabled = $true
15 | ScheduleInterval = 'Days'
16 | ScheduleCount = 7
17 | EnableDeltaDiscovery = $true
18 | DeltaDiscoveryMins = 50
19 | ADContainers = @(
20 | 'LDAP://OU=Far,DC=contoso,DC=com','LDAP://OU=Far,OU=Domain Controllers,DC=contoso,DC=com',
21 | 'LDAP://OU=Far,OU=Deployables,DC=contoso,DC=com'
22 | )
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/ConfigMgrCBDsc/xSccmInstall/SccmInstall.ps1:
--------------------------------------------------------------------------------
1 | #Requires -Module ConfigMgrCBDsc
2 |
3 | <#
4 | .DESCRIPTION
5 | This configuration Install Microsoft System Center Configuration Manager.
6 | #>
7 | Configuration Example
8 | {
9 | [CmdletBinding()]
10 | param
11 | (
12 | [Parameter()]
13 | [System.Management.Automation.PSCredential]
14 | $SccmInstallAccount
15 | )
16 |
17 | Import-DscResource -ModuleName ConfigMgrCBDsc
18 |
19 | Node localhost
20 | {
21 | xSccmInstall SccmInstall
22 | {
23 | SetupExePath = 'C:\Temp\SCCMInstall\SMSSETUP\BIN\X64'
24 | IniFile = 'C:\temp\Lab-CAS-Test.ini'
25 | SccmServerType = 'CAS'
26 | Version = 1902
27 | SccmInstallAccount = $SccmInstallAccount
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/SCFilePlanPropertyCitation/1-AddingNewCitation.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | SCFilePlanPropertyCitation 'FilePlanPropertyCitation'
18 | {
19 | Name = "Demo Citation"
20 | CitationURL = "https://contoso.com"
21 | CitationJurisdiction = "Federal"
22 | Ensure = "Present"
23 | Credential = $credsGlobalAdmin
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Microsoft_Examples/SharePointDsc/Resources/SPDatabaseAAG/2-AddMultipleDBstoAAG.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .EXAMPLE
3 | This example takes existing SharePoint databases, based on the database name pattern, and puts
4 | them in to the specified AlwaysOn Availability Group (AAG).
5 | #>
6 |
7 | Configuration Example
8 | {
9 | param(
10 | [Parameter(Mandatory = $true)]
11 | [PSCredential]
12 | $SetupAccount
13 | )
14 | Import-DscResource -ModuleName SharePointDsc
15 |
16 | node localhost {
17 | SPDatabaseAAG ConfigDBAAG
18 | {
19 | DatabaseName = '*Content*'
20 | AGName = 'MyAvailabilityGroup'
21 | FileShare = '\\SQL\Backups'
22 | PsDscRunAsCredential = $SetupAccount
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Microsoft_Examples/Microsoft365DSC/EXOManagementRole/1-ConfigureManagementRole.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | This example is used to test new resources and showcase the usage of new resources being worked on.
3 | It is not meant to use as a production baseline.
4 | #>
5 |
6 | Configuration Example
7 | {
8 | param(
9 | [Parameter(Mandatory = $true)]
10 | [PSCredential]
11 | $credsGlobalAdmin
12 | )
13 | Import-DscResource -ModuleName Microsoft365DSC
14 |
15 | node localhost
16 | {
17 | EXOManagementRole 'ConfigureManagementRole'
18 | {
19 | Name = "MyDisplayName"
20 | Description = ""
21 | Parent = "contoso.onmicrosoft.com\MyProfileInformation"
22 | Ensure = "Present"
23 | Credential = $credsGlobalAdmin
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------